Constructor
new Backoff(parameters, autoResetopt)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
parameters |
shaka.extern.RetryParameters | |||
autoReset |
boolean |
<optional> |
false | If true, start at a "first retry" state and and auto-reset that state when we reach maxAttempts. Default set to false. |
- Source:
Members
pendingDelay_ :Promise.PromiseWithResolvers
The resolvers of the delay currently being awaited by attempt(), if any.
Type:
- Promise.PromiseWithResolvers
- Source:
pendingTimer_ :shaka.util.Timer
The timer backing the delay currently being awaited by attempt(), if any.
Type:
- Source:
Methods
defaultRetryParameters() → {shaka.extern.RetryParameters}
Gets a copy of the default retry parameters.
- Source:
Returns:
defer(delayInMs, callback) → {shaka.util.Timer}
This method is only public for testing. It allows us to intercept the
time-delay call.
Parameters:
| Name | Type | Description |
|---|---|---|
delayInMs |
number | |
callback |
function() |
- Source:
Returns:
- Type
- shaka.util.Timer
fuzz_(value, fuzzFactor) → {number}
Fuzz the input value by +/- fuzzFactor. For example, a fuzzFactor of 0.5
will create a random value that is between 50% and 150% of the input value.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | |
fuzzFactor |
number |
- Source:
Returns:
The fuzzed value
- Type
- number
attempt() → {Promise}
- Source:
Returns:
Resolves when the caller may make an attempt, possibly
after a delay. Rejects if no more attempts are allowed, or if stop() is
called while we are waiting out a delay.
- Type
- Promise
stop()
Interrupts the delay of an in-progress attempt(), if any, making its
Promise reject with OPERATION_ABORTED right away. Attempts made after this
are unaffected.
- Source: