From 6e227c53fd74514711b7c8ba4ef59ec7cafaf023 Mon Sep 17 00:00:00 2001 From: mahyargdz Date: Sun, 27 Jul 2025 13:25:10 +0330 Subject: [PATCH] chore: update the email processor --- .../email/constants/email-events.constant.ts | 2 +- .../queue/email-bulk-action.processor.ts | 22 ------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/modules/email/constants/email-events.constant.ts b/src/modules/email/constants/email-events.constant.ts index 673fc64..fb9badc 100644 --- a/src/modules/email/constants/email-events.constant.ts +++ b/src/modules/email/constants/email-events.constant.ts @@ -45,7 +45,7 @@ export const EMAIL_QUEUE_CONSTANTS = { EMAIL_BULK_ACTION_EMPTY_SPAM: "email_bulk_action_empty_spam", // EMAIL_BULK_ACTION_DELAY: 1000, - EMAIL_BULK_ACTION_BATCH_SIZE: 1000, + EMAIL_BULK_ACTION_BATCH_SIZE: 250, EMAIL_BULK_ACTION_ATTEMPTS: 3, EMAIL_BULK_ACTION_BACKOFF_DELAY: 2000, // 2 seconds EMAIL_BULK_ACTION_PRIORITY: 1, diff --git a/src/modules/email/queue/email-bulk-action.processor.ts b/src/modules/email/queue/email-bulk-action.processor.ts index 332a2a5..cf1e794 100644 --- a/src/modules/email/queue/email-bulk-action.processor.ts +++ b/src/modules/email/queue/email-bulk-action.processor.ts @@ -127,17 +127,6 @@ export class EmailBulkActionProcessor extends WorkerHost { this.logger.log(`Emptying trash for user ${wildduckUserId} in mailbox ${mailboxId}`); try { - const response = await firstValueFrom( - this.mailServerService.messages.listMessages(wildduckUserId, mailboxId, { - limit: 1000, - }), - ); - - if (!response.results || response.results.length === 0) { - this.logger.log(`No messages found in trash for user ${wildduckUserId} in mailbox ${mailboxId}`); - return; - } - const { result } = await this.emailService.deleteAllMessages(wildduckUserId, mailboxId); if (!result.success) { @@ -161,17 +150,6 @@ export class EmailBulkActionProcessor extends WorkerHost { this.logger.log(`Emptying spam for user ${wildduckUserId} in mailbox ${mailboxId}`); try { - const response = await firstValueFrom( - this.mailServerService.messages.listMessages(wildduckUserId, mailboxId, { - limit: 1000, - }), - ); - - if (!response.results || response.results.length === 0) { - this.logger.log(`No messages found in spam for user ${wildduckUserId} in mailbox ${mailboxId}`); - return; - } - const { result } = await this.emailService.deleteAllMessages(wildduckUserId, mailboxId); if (!result.success) {