Skip to content

BusyWaitSleepStrategy

QuantConnect.Util.RateLimit.BusyWaitSleepStrategy

Bases: Object, ISleepStrategy

Provides a CPU intensive means of waiting for more tokens to be available in ITokenBucket. This strategy is only viable when the requested number of tokens is expected to become available in an extremely short period of time. This implementation aims to keep the current thread executing to prevent potential content switches arising from a thread yielding or sleeping strategy.

sleep

sleep() -> None

Provides a CPU intensive sleep by executing Thread.SpinWait for a single spin.