From 63f7f9a827c2142ea1fb485d3bfd6c373515dca7 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Tue, 12 Jan 2021 18:40:03 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Disabled=20auto-unsubscribe=20of?= =?UTF-8?q?=20members=20on=20permanent=20email=20failure=20events?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs https://github.com/TryGhost/Team/issues/446 Mailgun permanent failure events do not always correspond to unsubscribe-level events as originally thought, meaning some members could be unsubscribed unexpectedly due to delivery hiccups. - disabled auto-unsubscribe on permanent failure events in the analytics event processor - list maintenance will be added back in the future via alternative means --- .../services/email-analytics/lib/event-processor.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/core/server/services/email-analytics/lib/event-processor.js b/core/server/services/email-analytics/lib/event-processor.js index a111c28035..ce76727b09 100644 --- a/core/server/services/email-analytics/lib/event-processor.js +++ b/core/server/services/email-analytics/lib/event-processor.js @@ -109,18 +109,6 @@ class EmailAnalyticsEventProcessor { failed_at: this.db.knex.raw('COALESCE(failed_at, ?)', [moment.utc(event.timestamp).format('YYYY-MM-DD HH:mm:ss')]) }); - // saving via bookshelf triggers label fetch/update which errors and slows down processing - await this.db.knex('members') - .where('id', '=', this.db.knex('email_recipients') - .select('member_id') - .where('email_id', '=', emailId) - .where('member_email', '=', event.recipientEmail) - ) - .update({ - subscribed: false, - updated_at: moment.utc().toDate() - }); - return { failed: 1, emailIds: [emailId]