mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-01-30 16:26:16 +00:00
fix if notification throw exception, the heartbeat is not stored in to the db.
This commit is contained in:
parent
7e4a1ad279
commit
03b3bb5b30
1 changed files with 5 additions and 5 deletions
|
@ -121,8 +121,6 @@ class Monitor extends BeanModel {
|
||||||
this.id
|
this.id
|
||||||
])
|
])
|
||||||
|
|
||||||
let promiseList = [];
|
|
||||||
|
|
||||||
let text;
|
let text;
|
||||||
if (bean.status === 1) {
|
if (bean.status === 1) {
|
||||||
text = "✅ Up"
|
text = "✅ Up"
|
||||||
|
@ -133,10 +131,12 @@ class Monitor extends BeanModel {
|
||||||
let msg = `[${this.name}] [${text}] ${bean.msg}`;
|
let msg = `[${this.name}] [${text}] ${bean.msg}`;
|
||||||
|
|
||||||
for(let notification of notificationList) {
|
for(let notification of notificationList) {
|
||||||
promiseList.push(Notification.send(JSON.parse(notification.config), msg, await this.toJSON(), bean.toJSON()));
|
try {
|
||||||
|
await Notification.send(JSON.parse(notification.config), msg, await this.toJSON(), bean.toJSON())
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Cannot send notification to " + notification.name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(promiseList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue