mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
fix(Caching): sweep archived threads in all channel caches (#6312)
This commit is contained in:
@@ -635,6 +635,21 @@ class Util extends null {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @returns {SweepFilter}
|
||||
*/
|
||||
static archivedThreadSweepFilter(lifetime = 14400) {
|
||||
const filter = require('./LimitedCollection').filterByLifetime({
|
||||
lifetime,
|
||||
getComparisonTimestamp: e => e.archiveTimestamp,
|
||||
excludeFromSweep: e => !e.archived,
|
||||
});
|
||||
filter.isDefault = true;
|
||||
return filter;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Util;
|
||||
|
||||
Reference in New Issue
Block a user