Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

do not crash if SMTP server is down

Girish Ramakrishnan75594f474a3e
diff --git a/server.ts b/server.ts
index 8a762a9054..edfbab3d7f 100644
--- a/server.ts
+++ b/server.ts
@@ -249,7 +249,7 @@ async function startApplication () {
Emailer.Instance.init()
await Promise.all([
- Emailer.Instance.checkConnectionOrDie(),
+ Emailer.Instance.checkConnection(),
JobQueue.Instance.init()
])
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index 650a3c0909..e4e093fbc5 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 () {