Fix !clean sometimes cleaning too many messages
This commit is contained in:
parent
9ec93db08c
commit
94756faa5d
1 changed files with 3 additions and 1 deletions
|
@ -618,8 +618,10 @@ export class UtilityPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
if (moment.utc(message.posted_at).valueOf() < timeCutoff) return false;
|
if (moment.utc(message.posted_at).valueOf() < timeCutoff) return false;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
const remaining = args.count - messagesToClean.length;
|
||||||
|
const withoutOverflow = filtered.slice(0, remaining);
|
||||||
|
messagesToClean.push(...withoutOverflow);
|
||||||
|
|
||||||
messagesToClean.push(...filtered);
|
|
||||||
beforeId = potentialMessagesToClean[potentialMessagesToClean.length - 1].id;
|
beforeId = potentialMessagesToClean[potentialMessagesToClean.length - 1].id;
|
||||||
|
|
||||||
if (moment.utc(potentialMessagesToClean[potentialMessagesToClean.length - 1].posted_at).valueOf() < timeCutoff) {
|
if (moment.utc(potentialMessagesToClean[potentialMessagesToClean.length - 1].posted_at).valueOf() < timeCutoff) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue