Browse Source

[IMP] don't nag too often

pull/302/head
Holger Brunn 9 years ago
parent
commit
b286e85221
  1. 5
      dead_mans_switch_server/models/dead_mans_switch_instance.py

5
dead_mans_switch_server/models/dead_mans_switch_instance.py

@ -146,6 +146,11 @@ class DeadMansSwitchInstance(models.Model):
def panic(self): def panic(self):
"""override for custom handling""" """override for custom handling"""
self.ensure_one() self.ensure_one()
last_post = fields.Datetime.from_string(self.message_last_post)
if last_post >= datetime.utcnow() - 3 * timedelta(
seconds=self.alive_max_delay):
# don't nag too often
return
self.message_post( self.message_post(
type='comment', subtype='mt_comment', type='comment', subtype='mt_comment',
subject=_('Dead man\'s switch warning: %s') % subject=_('Dead man\'s switch warning: %s') %

Loading…
Cancel
Save