import FullJitterBackoff from './FullJitterBackoff' ; export default class FullJitterLimitedBackoff extends FullJitterBackoff { private attempts = 0 ; constructor ( fixedWaitMs , shortBackoffMs , longBackoffMs , private limit ) { super ( fixedWaitMs , shortBackoffMs , longBackoffMs ) ; } nextBackoffAmountMs ( ) { this . attempts ++ ; if ( this . attempts > this . limit ) { throw new Error ( 'retry limit exceeded' ) ; } return super . nextBackoffAmountMs ( ) ; } }