diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-20 16:15:03 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-20 16:15:03 +0100 |
commit | 645c47d975e3c34a092acddf4a5f9420010755bc (patch) | |
tree | 6c667f44b01425efe6e7e4e10813bfe0cc082632 /lib/mauve/timer.rb | |
parent | 53f89ba450850990057883a92f89ed994563e4ab (diff) |
* Added heartbeat to remote mauve
* Added URLs to messages
* Added example configuration file
* Added various docs
* XMPP messages now XHTML and TXT
* Handling of MUC reconnection a bit better.
Diffstat (limited to 'lib/mauve/timer.rb')
-rw-r--r-- | lib/mauve/timer.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/mauve/timer.rb b/lib/mauve/timer.rb index f6ada88..91dea18 100644 --- a/lib/mauve/timer.rb +++ b/lib/mauve/timer.rb @@ -13,12 +13,6 @@ module Mauve attr_accessor :sleep_interval, :last_run_at - def initialize - super - @initial_sleep = 300 - @initial_sleep_threshold = 300 - end - def main_loop # # Get the next alert. @@ -51,22 +45,27 @@ module Mauve # # Sleep indefinitely # - logger.info("Nothing to notify about -- snoozing indefinitely.") + logger.info("Nothing to notify about -- snoozing for a while.") + sleep_loops = 600 else # # La la la nothing to do. # logger.info("Next to notify: #{next_to_notify} -- snoozing until #{next_to_notify.due_at}") + sleep_loops = ((next_to_notify.due_at - MauveTime.now).to_f / 0.1).round.to_i end + sleep_loops = 1 if sleep_loops.nil? or sleep_loops < 1 + # # Ah-ha! Sleep with a break clause. # - while next_to_notify.nil? or MauveTime.now <= next_to_notify.due_at + sleep_loops.times do # # Start again if the situation has changed. # break if self.should_stop? + # # This is a rate-limiting step for alerts. # |