Skip to content

Commit

Permalink
Merge pull request #155 from guardian/bugfix-not-expire-zero-timeout
Browse files Browse the repository at this point in the history
Do not expire alerts with zero timeouts
  • Loading branch information
satterly committed Feb 21, 2016
2 parents 3dff714 + a2721b3 commit ef9c0ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/mongo/housekeepingAlerts.js
Expand Up @@ -5,8 +5,8 @@ now = new Date();

// mark timed out alerts as EXPIRED and update alert history
db.alerts.aggregate([
{ $project: { event: 1, status: 1, expireTime: { $add: [ "$lastReceiveTime", { $multiply: [ "$timeout", 1000 ]}]}}},
{ $match: { status: 'open', "expireTime": { $lt: now }}}
{ $project: { event: 1, status: 1, timeout: 1, expireTime: { $add: [ "$lastReceiveTime", { $multiply: [ "$timeout", 1000 ]} ]} } },
{ $match: { status: 'open', expireTime: { $lt: now }, timeout: { $ne: 0 }}}
]).forEach( function(alert) {
db.alerts.update(
{ _id: alert._id },
Expand Down

0 comments on commit ef9c0ba

Please sign in to comment.