fix task exception and send mail in dev with no smtp settings

This commit is contained in:
lesion 2021-12-03 16:20:54 +01:00
parent 88612dbd8b
commit c58de0bba8
No known key found for this signature in database
GPG key ID: 352918250B012177
2 changed files with 3 additions and 4 deletions

View file

@ -8,7 +8,7 @@ const locales = require('../../locales')
const mail = {
send (addresses, template, locals, locale = settingsController.settings.instance_locale) {
if (!settingsController.settings.admin_email || !settingsController.settings.smtp) {
if (process.env.NODE_ENV === 'production' && (!settingsController.settings.admin_email || !settingsController.settings.smtp)) {
log.error(`Cannot send any email: SMTP Email configuration not completed!`)
return
}
@ -47,7 +47,7 @@ const mail = {
locale,
locales: Object.keys(locales)
},
transport: settings.smtp
transport: settings.smtp || {}
})
const msg = {

View file

@ -33,7 +33,6 @@ class Task {
}
} catch (e) {
log.error(`TASK ERROR [${this.name}]: ${e} ${e.stack}`)
return Promise.resolve(false)
}
}
}
@ -84,7 +83,7 @@ class TaskManager {
// remove removable tasks
this.tasks = this.tasks.filter(t => t.repeat)
return Promise.all(tasks)
return Promise.allSettled(tasks)
}
async tick () {