chore: update the email processor
This commit is contained in:
@@ -45,7 +45,7 @@ export const EMAIL_QUEUE_CONSTANTS = {
|
|||||||
EMAIL_BULK_ACTION_EMPTY_SPAM: "email_bulk_action_empty_spam",
|
EMAIL_BULK_ACTION_EMPTY_SPAM: "email_bulk_action_empty_spam",
|
||||||
//
|
//
|
||||||
EMAIL_BULK_ACTION_DELAY: 1000,
|
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_ATTEMPTS: 3,
|
||||||
EMAIL_BULK_ACTION_BACKOFF_DELAY: 2000, // 2 seconds
|
EMAIL_BULK_ACTION_BACKOFF_DELAY: 2000, // 2 seconds
|
||||||
EMAIL_BULK_ACTION_PRIORITY: 1,
|
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}`);
|
this.logger.log(`Emptying trash for user ${wildduckUserId} in mailbox ${mailboxId}`);
|
||||||
|
|
||||||
try {
|
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);
|
const { result } = await this.emailService.deleteAllMessages(wildduckUserId, mailboxId);
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
@@ -161,17 +150,6 @@ export class EmailBulkActionProcessor extends WorkerHost {
|
|||||||
this.logger.log(`Emptying spam for user ${wildduckUserId} in mailbox ${mailboxId}`);
|
this.logger.log(`Emptying spam for user ${wildduckUserId} in mailbox ${mailboxId}`);
|
||||||
|
|
||||||
try {
|
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);
|
const { result } = await this.emailService.deleteAllMessages(wildduckUserId, mailboxId);
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user