ThreadSleepStrategy
QuantConnect.Util.RateLimit.ThreadSleepStrategy
ThreadSleepStrategy(milliseconds: int)
Bases: Object, ISleepStrategy
Provides a CPU non-intensive means of waiting for more tokens to be available in ITokenBucket. This strategy should be the most commonly used as it either sleeps or yields the currently executing thread, allowing for other threads to execute while the current thread is blocked and waiting for new tokens to become available in the bucket for consumption.
Initializes a new instance of the ThreadSleepStrategy using the specified number of milliseconds for each sleep invocation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
milliseconds
|
int
|
The duration of time to sleep, in milliseconds |
required |
YIELDING
YIELDING: ISleepStrategy = ...
Gets an instance of ISleepStrategy that yields the current thread
sleep
sleep() -> None
Sleeps the current thread using the initialized number of milliseconds
sleeping
sleeping(milliseconds: int) -> ISleepStrategy
Gets an instance of ISleepStrategy that sleeps the current thread for the specified number of milliseconds
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
milliseconds
|
int
|
The duration of time to sleep, in milliseconds |
required |