module license /** Options for an exponential backoff. */ export interface BackoffOptions { exponentialBackoffBase : number ; constantBackoffMs : number ; maxBackoffMs : number ; maxRetries : number ; } /** Default options for an exponential backoff. */ export const DEFAULT_BACKOFF_OPTIONS = { exponentialBackoffBase : 2 , constantBackoffMs : 500 , maxBackoffMs : 3000 , maxRetries : - 1 , } ; /**
 * Gets the number of milliseconds to elapse for a given number of retries
 * and a backoff schedule.
 */ export function getBackoffMs ( options , retries ) { let backoffMs = Math . pow ( options . exponentialBackoffBase , retries ) * options . constantBackoffMs ; if ( options . maxBackoffMs > 0 && backoffMs > options . maxBackoffMs ) { backoffMs = options . maxBackoffMs ; } return backoffMs ; }