cypress-backoff

Source:

Methods

(inner) linear(timeoutInMilliseconds)

Description:
  • Provide the desired timeout increase in milliseconds. The timeout will increase with this number for every next attempt, i.e. 1000, 2000, 3000...

Source:
Example
backoff.linear(1000)
Parameters:
Name Type Description
timeoutInMilliseconds number

the amount of milliseconds added to the timeout for each retry attempt

(inner) exponential(timeoutInMilliseconds, exponentialRate)

Description:
  • Provide the desired timeout in milliseconds and exponential rate. The timeout will be calculated as T = timeout * exponentialrate ^ r

Source:
Example
backoff.exponential(1000, 2)
Parameters:
Name Type Description
timeoutInMilliseconds number

the base timeout in milliseconds

exponentialRate number

the exponent at which the timeout grows

(inner) fibonacci(timeoutInMilliseconds)

Description:
  • Provide the desired timeout which will be multiplied by the fibonacci number of the retry.

Source:
Example
backoff.fibonacci(1000)
Parameters:
Name Type Description
timeoutInMilliseconds number

the base amount for the timeout

(inner) fixed(timeouts)

Description:
  • Provide an array with the desired timeout for each subsequent retry. If you allow more retries than elements specified the last element will be used.

Source:
Example
backoff.fixed([1000, 2000, 3000])
Parameters:
Name Type Description
timeouts Array.<number>

an array of numbers which will be used in order for the timeout of each retry

(inner) custom(fun)

Description:
  • Provide a custom function that accepts the retry count as a parameter and returns the desired timeout.

Source:
Example
backoff.custom((retryCount) => {return retryCount*2000})
Parameters:
Name Type Description
fun function

a function that accepts 1 parameter - the count of retries