feat(Client): add global sweepers (#6825)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Almeida <almeidx@pm.me>
This commit is contained in:
ckohen
2021-12-15 04:39:27 -08:00
committed by GitHub
parent bc6a6c539f
commit d1ef2f5e8b
7 changed files with 660 additions and 63 deletions

View File

@@ -590,14 +590,11 @@ class Util extends null {
/**
* Creates a sweep filter that sweeps archived threads
* @param {number} [lifetime=14400] How long a thread has to be archived to be valid for sweeping
* @deprecated When not using with `makeCache` use `Sweepers.archivedThreadSweepFilter` instead
* @returns {SweepFilter}
*/
static archivedThreadSweepFilter(lifetime = 14400) {
const filter = require('./LimitedCollection').filterByLifetime({
lifetime,
getComparisonTimestamp: e => e.archiveTimestamp,
excludeFromSweep: e => !e.archived,
});
const filter = require('./Sweepers').archivedThreadSweepFilter(lifetime);
filter.isDefault = true;
return filter;
}