|
Twitch SDK (Internal)
|
#include <timer.h>
Public Member Functions | |
| RetryTimer () | |
| RetryTimer (const std::vector< uint64_t > &backOffTableMs, uint64_t retryJitterWidthMs) | |
| RetryTimer (uint64_t maxInterval, uint64_t retryJitterWidthMs) | |
| void | SetBackoffTable (const std::vector< uint64_t > &backOffTableMs, uint64_t retryJitterWidthMs) |
| void | SetBackoffTable (uint64_t maxInterval, uint64_t retryJitterWidthMs) |
| void | ScheduleNextRetry () |
| bool | CheckNextRetry () |
| void | Clear () |
| void | StartGlobalReset (uint64_t milliseconds) |
| bool | CheckGlobalReset () |
| void | ClearGlobalReset () |
| bool | IsRetrySet () const |
| bool | IsGlobalSet () const |
Protected Member Functions | |
| uint64_t | GetNextAttempt () |
Protected Attributes | |
| WaitForExpiry | mNextRetry |
| WaitForExpiry | mGlobalResetTimer |
| The timer which will reset mNextAttemptNumber. More... | |
| std::vector< uint64_t > | mBackOffTable |
| uint64_t | mRetryJitter |
| uint32_t | mNextAttemptNumber |
Manages the timing of requests or connections to backend services. Supports backoff as attempts continue to fail.
Call ScheduleNextRetry() to start the timer. Call CheckNextRetry() periodically to see if it's time to retry. Once this returns true it will not return true again until ScheduleNextRetry() is called. Call Clear() to stop the retry timer and reset the backoff table if not managing a persisten connection.
Optionally, if the timer is managing a persistent connection then the backoff table reset can be controlled using the following methods. Call StartGlobalReset() when successfully connected to begin the timer that will reset the backoff. Call CheckGlobalReset() periodically to apply the backoff reset when it's time. Call ClearGlobalReset() when CheckGlobalReset() has elapsed or the request completes sucessfully / the connection is closed purposefully.
| ttv::RetryTimer::RetryTimer | ( | ) |
Configures the timer with a default table.
| ttv::RetryTimer::RetryTimer | ( | const std::vector< uint64_t > & | backOffTableMs, |
| uint64_t | retryJitterWidthMs | ||
| ) |
Configures the timer with an explicit table.
| ttv::RetryTimer::RetryTimer | ( | uint64_t | maxInterval, |
| uint64_t | retryJitterWidthMs | ||
| ) |
Configures the timer with exponential backoff up to the given interval.
| bool ttv::RetryTimer::CheckGlobalReset | ( | ) |
| bool ttv::RetryTimer::CheckNextRetry | ( | ) |
Used to determine if it's time to retry. When the result of the attempt is complete be sure to call RetryComplete().
| void ttv::RetryTimer::Clear | ( | ) |
Stops the retry timer and resets the backoff table. This should be called when done with the timer and not managing a persistent connection.
| void ttv::RetryTimer::ClearGlobalReset | ( | ) |
|
protected |
|
inline |
|
inline |
| void ttv::RetryTimer::ScheduleNextRetry | ( | ) |
Marks the current retry as complete and advances the retry timer to the next attempt.
| void ttv::RetryTimer::SetBackoffTable | ( | const std::vector< uint64_t > & | backOffTableMs, |
| uint64_t | retryJitterWidthMs | ||
| ) |
| void ttv::RetryTimer::SetBackoffTable | ( | uint64_t | maxInterval, |
| uint64_t | retryJitterWidthMs | ||
| ) |
| void ttv::RetryTimer::StartGlobalReset | ( | uint64_t | milliseconds | ) |
|
protected |
|
protected |
The timer which will reset mNextAttemptNumber.
|
protected |
|
protected |
|
protected |
1.8.13