From b35eef1b02a5025f6d32f05091ce88ce263778b1 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Tue, 1 Dec 2020 09:10:43 +0000 Subject: [PATCH] Added kill-switch config for email analytics background jobs no issue - it's possible background jobs may cause unintended side-effects so it's useful to have a kill-switch to disable them individually to keep sites working --- core/server/index.js | 14 ++++++++------ core/shared/config/defaults.json | 5 ++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/server/index.js b/core/server/index.js index 9e3fe6431b..660c413a20 100644 --- a/core/server/index.js +++ b/core/server/index.js @@ -78,12 +78,14 @@ function initializeRecurringJobs() { const jobsService = require('./services/jobs'); - jobsService.scheduleJob( - 'every 1 minute', - path.resolve(__dirname, 'services', 'email-analytics', 'jobs', 'fetch-latest.js'), - undefined, - 'email-analytics-fetch-latest' - ); + if (config.get('backgroundJobs:emailAnalytics')) { + jobsService.scheduleJob( + 'every 1 minute', + path.resolve(__dirname, 'services', 'email-analytics', 'jobs', 'fetch-latest.js'), + undefined, + 'email-analytics-fetch-latest' + ); + } } /** diff --git a/core/shared/config/defaults.json b/core/shared/config/defaults.json index 218008f082..1d60aca412 100644 --- a/core/shared/config/defaults.json +++ b/core/shared/config/defaults.json @@ -115,5 +115,8 @@ "adminFrameProtection": true, "sendWelcomeEmail": true, "stripeDirect": false, - "enableStripePromoCodes": false + "enableStripePromoCodes": false, + "backgroundJobs": { + "emailAnalytics": true + } }