chore: update the email processor

This commit is contained in:
mahyargdz
2025-07-27 13:25:10 +03:30
parent 7cee095149
commit 6e227c53fd
2 changed files with 1 additions and 23 deletions
@@ -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,
@@ -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) {