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

@ -2,13 +2,11 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { MessageModel } from '../models/messages';
import * as durations from './durations';
import { map, filter } from './iterables';
import { isNotNil } from './isNotNil';
const SECOND = 1000;
const MINUTE = SECOND * 60;
const FIVE_MINUTES = MINUTE * 5;
const HOUR = MINUTE * 60;
const FIVE_MINUTES = 5 * durations.MINUTE;
type LookupItemType = {
timestamp: number;
@ -121,6 +119,6 @@ export class MessageController {
}
startCleanupInterval(): NodeJS.Timeout | number {
return setInterval(this.cleanup.bind(this), HOUR);
return setInterval(this.cleanup.bind(this), durations.HOUR);
}
}