From a58396b2dec12e7effbafa1db53ed31745d2dc40 Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Tue, 7 Mar 2023 11:40:55 +0100 Subject: [PATCH] Removed email sending retrying in test mode no issue Disables email sending retrying in test mode by default. This is to prevent test timeouts and to make testing more reliable in case where we manually let a batch fail. --- ghost/email-service/lib/batch-sending-service.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ghost/email-service/lib/batch-sending-service.js b/ghost/email-service/lib/batch-sending-service.js index fa32710bbc..1d32d75408 100644 --- a/ghost/email-service/lib/batch-sending-service.js +++ b/ghost/email-service/lib/batch-sending-service.js @@ -75,10 +75,19 @@ class BatchSendingService { if (BEFORE_RETRY_CONFIG) { this.#BEFORE_RETRY_CONFIG = BEFORE_RETRY_CONFIG; + } else { + if (process.env.NODE_ENV.startsWith('test')) { + this.#BEFORE_RETRY_CONFIG = {maxRetries: 0}; + } } if (AFTER_RETRY_CONFIG) { this.#AFTER_RETRY_CONFIG = AFTER_RETRY_CONFIG; + } else { + if (process.env.NODE_ENV.startsWith('test')) { + this.#AFTER_RETRY_CONFIG = {maxRetries: 0}; + } } + if (MAILGUN_API_RETRY_CONFIG) { this.#MAILGUN_API_RETRY_CONFIG = MAILGUN_API_RETRY_CONFIG; } else {