Browse Source

[FIX] travis

pull/302/head
Holger Brunn 9 years ago
parent
commit
54c8ddc78e
  1. 10
      dead_mans_switch_server/models/dead_mans_switch_instance.py

10
dead_mans_switch_server/models/dead_mans_switch_instance.py

@ -110,7 +110,7 @@ class DeadMansSwitchInstance(models.Model):
'on l.instance_id=i.id '
"where coalesce(l.create_date, '1970-01-01'::timestamp) %s "
"now() at time zone 'utc' - "
"(alive_max_delay || 'seconds')::interval "
"(2 * alive_max_delay || 'seconds')::interval "
"group by i.id " %
(alive and '>=' or '<'))
return [('id', 'in', [i for i, in self.env.cr.fetchall()])]
@ -139,13 +139,7 @@ class DeadMansSwitchInstance(models.Model):
@api.model
def check_alive(self):
"""handle cronjob"""
for this in self.search([('state', '=', 'active')]):
if this.alive:
continue
last_post = fields.Datetime.from_string(this.message_last_post)
if not last_post or datetime.utcnow() - timedelta(
seconds=this.alive_max_delay * 2) > last_post:
this.panic()
self.search(self._needaction_domain_get()).panic()
@api.multi
def panic(self):

Loading…
Cancel
Save