Skip to content

Commit 12d0182

Browse files
committed
wait searchDelay between batch jobs
1 parent e74ad8c commit 12d0182

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/undiscord-core.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class UndiscordCore {
3232
pattern: null, // Only delete messages that match the regex (insensitive)
3333
searchDelay: null, // Delay each time we fetch for more messages
3434
deleteDelay: null, // Delay between each delete operation
35+
jobDelay: 30000, // Delay between each job during batches
3536
maxAttempt: 2, // Attempts to delete a single message if it fails
3637
askForConfirmation: true,
3738
};
@@ -86,6 +87,11 @@ class UndiscordCore {
8687

8788
log.info(`Runnning batch with queue of ${queue.length} jobs`);
8889
for (let i = 0; i < queue.length; i++) {
90+
if (i > 0) {
91+
log.verb(`Waiting ${(this.options.jobDelay / 1000).toFixed(2)}s before next job...`);
92+
await wait(this.options.jobDelay);
93+
}
94+
8995
const job = queue[i];
9096
log.info('Starting job...', `(${i + 1}/${queue.length})`);
9197

0 commit comments

Comments
 (0)