From 71bebb7c27c7f053629af5ffe6cec26a894cd6d5 Mon Sep 17 00:00:00 2001 From: baldo Date: Sat, 25 Jun 2016 20:24:28 +0200 Subject: [PATCH] Fixed fix for sending mails in short time --- server/services/monitoringService.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/services/monitoringService.js b/server/services/monitoringService.js index d2be71c..cb4cd44 100644 --- a/server/services/monitoringService.js +++ b/server/services/monitoringService.js @@ -34,7 +34,7 @@ angular.module('ffffng') return Database.run( 'INSERT INTO node_state ' + - '(mac, state, last_seen, import_timestamp, last_status_mail_sent, last_status_mail_type) ' + + '(mac, state, last_seen, import_timestamp, (last_status_mail_sent, last_status_mail_type) OR last_status_mail_type IS NULL) ' + 'VALUES (?, ?, ?, ?, ?, ?)', [ node.mac, @@ -267,7 +267,7 @@ angular.module('ffffng') var now = moment().unix(); Database.run( 'UPDATE node_state ' + - 'SET modified_at = ?, last_status_mail_sent = ?, last_status_mail_type = ?' + + 'SET modified_at = ?, (last_status_mail_sent = ?, last_status_mail_type = OR last_status_mail_type IS NULL)?' + 'WHERE id = ?', [ now, now, mailType, @@ -335,7 +335,7 @@ angular.module('ffffng') Database.all( 'SELECT * FROM node_state ' + 'WHERE modified_at < ? AND state = ? AND (last_status_mail_type = ?' + allowNull + ') AND ' + - 'last_seen <= ? AND last_status_mail_sent <= ? ' + + 'last_seen <= ? AND (last_status_mail_sent <= ? OR last_status_mail_sent IS NULL) ' + 'ORDER BY id ASC LIMIT ?', [ startTime.unix(),