do not send notification if first beat is UP

pull/6/head
LouisLam 3 years ago
parent 072e86542a
commit ff4259380e

@ -109,6 +109,8 @@ class Monitor extends BeanModel {
if (! previousBeat || previousBeat.status !== bean.status) { if (! previousBeat || previousBeat.status !== bean.status) {
bean.important = true; bean.important = true;
// Do not send if first beat is UP
if (previousBeat || bean.status !== 1) {
let notificationList = await R.getAll(`SELECT notification.* FROM notification, monitor_notification WHERE monitor_id = ? AND monitor_notification.notification_id = notification.id `, [ let notificationList = await R.getAll(`SELECT notification.* FROM notification, monitor_notification WHERE monitor_id = ? AND monitor_notification.notification_id = notification.id `, [
this.id this.id
]) ])
@ -129,6 +131,7 @@ class Monitor extends BeanModel {
} }
await Promise.all(promiseList); await Promise.all(promiseList);
}
} else { } else {
bean.important = false; bean.important = false;

Loading…
Cancel
Save