UNPKG

scrivito

Version:

Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.

19 lines (14 loc) 426 B
import { waitMs } from 'scrivito_sdk/common'; export class ExponentialBackoff { private retryCount = 0; // for test purposes only numberOfRetries(): number { return this.retryCount; } /** waits for an exponentially increasing amount of time */ nextDelay(): Promise<void> { const timeToWait = Math.pow(2, Math.min(this.retryCount, 16)) * 500; this.retryCount++; return waitMs(timeToWait); } }