CooldownHelper

A helper class to keep track of a cooldown period based on errors occurring.

Parameters

maxInterval

The maximum amount of time a cooldown period can last.

errorBaseInterval

The amount of time to extend the cooldown for each consecutive failure, limited by the maxInterval

status

Defaults to CooldownStatus.Success, but this is typically only used for testing.

timingProvider

Provider function to provide the current time

Types

Link copied to clipboard
object Companion
Link copied to clipboard

The CooldownStatus describes the result of a previous event.

Properties

Link copied to clipboard
Link copied to clipboard

Gets the number of consecutive CooldownStatus.Failures that have been reported.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun isInCooldown(lastFetch: Long): Boolean

Determines whether or not the Cooldown period, if currently in one, has elapsed.

Link copied to clipboard

Used to notify the CooldownHelper of the latest status.