log scheduling events clearer

This commit is contained in:
boyska 2017-01-19 11:35:33 +01:00
parent 7f78bee6ff
commit ea2013904c
No known key found for this signature in database
GPG key ID: 7395DCAE58289CA9

View file

@ -130,17 +130,20 @@ class Monitor(ParentedLet):
# why this 2*EVENT_TICK_SECS? EVENT_TICK_SECS would be enough, # why this 2*EVENT_TICK_SECS? EVENT_TICK_SECS would be enough,
# but it is "tricky"; any small delay would cause the event to be # but it is "tricky"; any small delay would cause the event to be
# missed # missed
if delta is not None and delta <= 2*self.conf['EVENT_TICK_SECS']: if delta is None:
self.log.debug('Skipping event %s: will never ring',
alarm.get('nick', alarm.eid))
elif delta <= 2*self.conf['EVENT_TICK_SECS']:
self.log.debug('Scheduling event %s (%ds) => %s', self.log.debug('Scheduling event %s (%ds) => %s',
alarm.get('nick', alarm.eid), alarm.get('nick', alarm.eid),
delta if delta is not None else -1, delta,
[a.get('nick', a.eid) for a in actions] [a.get('nick', a.eid) for a in actions]
) )
self.schedule(alarm, actions, delta) self.schedule(alarm, actions, delta)
else: else:
self.log.debug('Skipping event %s too far (%ds)', self.log.debug('Skipping event %s too far (%ds)',
alarm.get('nick', alarm.eid), alarm.get('nick', alarm.eid),
delta if delta is not None else -1, delta,
) )
def schedule(self, timespec, audiospecs, delta=None): def schedule(self, timespec, audiospecs, delta=None):