Add durations utility for computing durations

This commit is contained in:
Evan Hahn 2021-08-26 09:10:58 -05:00 committed by GitHub
parent c6aa668a9b
commit f86f753df9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 99 additions and 95 deletions

View file

@ -1,10 +1,10 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as moment from 'moment';
import * as durations from './durations';
const BACKOFF_FACTOR = 1.9;
const MAX_BACKOFF = moment.duration(15, 'minutes').asMilliseconds();
const MAX_BACKOFF = 15 * durations.MINUTE;
/**
* For a given attempt, how long should we sleep (in milliseconds)?