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

@ -13,7 +13,6 @@ import mkdirp from 'mkdirp';
import rimraf from 'rimraf';
import SQL, { Database, Statement } from 'better-sqlite3';
import pProps from 'p-props';
import * as moment from 'moment';
import { v4 as generateUUID } from 'uuid';
import {
@ -41,6 +40,7 @@ import { dropNull } from '../util/dropNull';
import { isNormalNumber } from '../util/isNormalNumber';
import { isNotNil } from '../util/isNotNil';
import { parseIntOrThrow } from '../util/parseIntOrThrow';
import * as durations from '../util/durations';
import { formatCountForLogging } from '../logging/formatCountForLogging';
import { ConversationColorType, CustomColorType } from '../types/Colors';
import { ProcessGroupCallRingRequestResult } from '../types/Calling';
@ -5965,7 +5965,7 @@ async function processGroupCallRingCancelation(ringId: bigint): Promise<void> {
// This age, in milliseconds, should be longer than any group call ring duration. Beyond
// that, it doesn't really matter what the value is.
const MAX_GROUP_CALL_RING_AGE = moment.duration(30, 'minutes').asMilliseconds();
const MAX_GROUP_CALL_RING_AGE = 30 * durations.MINUTE;
async function cleanExpiredGroupCallRings(): Promise<void> {
const db = getInstance();