From 75594f474a3e04086b37a014d23e89780ca67458 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 11 Dec 2020 12:02:32 -0800 Subject: do not crash if SMTP server is down just log a warning if the SMTP server is down on startup time fixes #3457 --- server/lib/emailer.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'server/lib') diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index 650a3c090..e4e093fbc 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -107,18 +107,18 @@ class Emailer { } } - async checkConnectionOrDie () { + async checkConnection () { if (!this.transporter || CONFIG.SMTP.TRANSPORT !== 'smtp') return logger.info('Testing SMTP server...') try { const success = await this.transporter.verify() - if (success !== true) this.dieOnConnectionFailure() + if (success !== true) this.warnOnConnectionFailure() logger.info('Successfully connected to SMTP server.') } catch (err) { - this.dieOnConnectionFailure(err) + this.warnOnConnectionFailure(err) } } @@ -636,9 +636,8 @@ class Emailer { } } - private dieOnConnectionFailure (err?: Error) { + private warnOnConnectionFailure (err?: Error) { logger.error('Failed to connect to SMTP %s:%d.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT, { err }) - process.exit(-1) } static get Instance () { -- cgit v1.2.3