More frequent message cleanup

This commit is contained in:
Fedor Indutny 2022-01-13 10:30:51 -08:00 committed by GitHub
parent 3448f7da92
commit 31c6a2fc0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -14,6 +14,7 @@ export type ConfigKeyType =
| 'desktop.groupCalling' | 'desktop.groupCalling'
| 'desktop.gv2' | 'desktop.gv2'
| 'desktop.internalUser' | 'desktop.internalUser'
| 'desktop.messageCleanup'
| 'desktop.mandatoryProfileSharing' | 'desktop.mandatoryProfileSharing'
| 'desktop.mediaQuality.levels' | 'desktop.mediaQuality.levels'
| 'desktop.messageRequests' | 'desktop.messageRequests'

View file

@ -6,6 +6,7 @@ import * as durations from './durations';
import { map, filter } from './iterables'; import { map, filter } from './iterables';
import { isNotNil } from './isNotNil'; import { isNotNil } from './isNotNil';
import type { MessageAttributesType } from '../model-types.d'; import type { MessageAttributesType } from '../model-types.d';
import { isEnabled } from '../RemoteConfig';
const FIVE_MINUTES = 5 * durations.MINUTE; const FIVE_MINUTES = 5 * durations.MINUTE;
@ -125,6 +126,9 @@ export class MessageController {
} }
startCleanupInterval(): NodeJS.Timeout | number { startCleanupInterval(): NodeJS.Timeout | number {
return setInterval(this.cleanup.bind(this), durations.HOUR); return setInterval(
this.cleanup.bind(this),
isEnabled('desktop.messageCleanup') ? FIVE_MINUTES : durations.HOUR
);
} }
} }