From cb21d8385c7f170cd86c12008933ba1728007448 Mon Sep 17 00:00:00 2001 From: Pierre Lehnen Date: Wed, 26 Feb 2020 16:21:28 -0300 Subject: [PATCH] Defer the enrollment email so it doesn't lock the processing of the current request --- app/lib/server/functions/setUsername.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/lib/server/functions/setUsername.js b/app/lib/server/functions/setUsername.js index d705d436c084..7656e7dbe4af 100644 --- a/app/lib/server/functions/setUsername.js +++ b/app/lib/server/functions/setUsername.js @@ -41,7 +41,9 @@ export const _setUsername = function(userId, u) { // If first time setting username, send Enrollment Email try { if (!previousUsername && user.emails && user.emails.length > 0 && settings.get('Accounts_Enrollment_Email')) { - Accounts.sendEnrollmentEmail(user._id); + Meteor.defer(() => { + Accounts.sendEnrollmentEmail(user._id); + }); } } catch (e) { console.error(e);