From 9862689c0c34f102f7719ab415fa1eb64e6a6059 Mon Sep 17 00:00:00 2001 From: Andreas Knuth Date: Sun, 12 Apr 2026 20:43:37 -0500 Subject: [PATCH] no markAsBlocked, --- .../src/worker/message-processor.ts | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/email-worker-nodejs/src/worker/message-processor.ts b/email-worker-nodejs/src/worker/message-processor.ts index 12ce679..0f95b57 100644 --- a/email-worker-nodejs/src/worker/message-processor.ts +++ b/email-worker-nodejs/src/worker/message-processor.ts @@ -26,7 +26,7 @@ import { BlocklistChecker } from '../email/blocklist.js'; import { BounceHandler } from '../email/bounce-handler.js'; import { parseEmail, isProcessedByWorker } from '../email/parser.js'; import { RulesProcessor } from '../email/rules-processor.js'; - +import { config } from '../config.js'; // --------------------------------------------------------------------------- // Processor // --------------------------------------------------------------------------- @@ -258,34 +258,40 @@ export class MessageProcessor { if (totalHandled === recipients.length) { if (blockedRecipients.length === recipients.length) { - // All blocked - try { - await this.s3.markAsBlocked( - domain, - messageId, - blockedRecipients, - fromAddrFinal, - workerName, - ); - await this.s3.deleteBlockedEmail(domain, messageId, workerName); - } catch (err: any) { - log(`⚠ Failed to handle blocked email: ${err.message ?? err}`, 'ERROR', workerName); - return false; + // All blocked — im Standby kein S3 anfassen + if (!config.standbyMode) { + try { + await this.s3.markAsBlocked( + domain, + messageId, + blockedRecipients, + fromAddrFinal, + workerName, + ); + await this.s3.deleteBlockedEmail(domain, messageId, workerName); + } catch (err: any) { + log(`⚠ Failed to handle blocked email: ${err.message ?? err}`, 'ERROR', workerName); + return false; + } } } else if (successful.length > 0) { - await this.s3.markAsProcessed( - domain, - messageId, - workerName, - failedPermanent.length > 0 ? failedPermanent : undefined, - ); + if (!config.standbyMode) { + await this.s3.markAsProcessed( + domain, + messageId, + workerName, + failedPermanent.length > 0 ? failedPermanent : undefined, + ); + } } else if (failedPermanent.length > 0) { - await this.s3.markAsAllInvalid( - domain, - messageId, - failedPermanent, - workerName, - ); + if (!config.standbyMode) { + await this.s3.markAsAllInvalid( + domain, + messageId, + failedPermanent, + workerName, + ); + } } // Summary