Fixed fix for sending mails in short time
This commit is contained in:
parent
f7f816939b
commit
71bebb7c27
|
@ -34,7 +34,7 @@ angular.module('ffffng')
|
||||||
|
|
||||||
return Database.run(
|
return Database.run(
|
||||||
'INSERT INTO node_state ' +
|
'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 (?, ?, ?, ?, ?, ?)',
|
'VALUES (?, ?, ?, ?, ?, ?)',
|
||||||
[
|
[
|
||||||
node.mac,
|
node.mac,
|
||||||
|
@ -267,7 +267,7 @@ angular.module('ffffng')
|
||||||
var now = moment().unix();
|
var now = moment().unix();
|
||||||
Database.run(
|
Database.run(
|
||||||
'UPDATE node_state ' +
|
'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 = ?',
|
'WHERE id = ?',
|
||||||
[
|
[
|
||||||
now, now, mailType,
|
now, now, mailType,
|
||||||
|
@ -335,7 +335,7 @@ angular.module('ffffng')
|
||||||
Database.all(
|
Database.all(
|
||||||
'SELECT * FROM node_state ' +
|
'SELECT * FROM node_state ' +
|
||||||
'WHERE modified_at < ? AND state = ? AND (last_status_mail_type = ?' + allowNull + ') AND ' +
|
'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 ?',
|
'ORDER BY id ASC LIMIT ?',
|
||||||
[
|
[
|
||||||
startTime.unix(),
|
startTime.unix(),
|
||||||
|
|
Loading…
Reference in a new issue