commit 3a75ba2de021948280f4a6b477b4db644b13f727
parent 5661a4ffcb6182725114d2a260dd8c9f6cce324f
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date: Sun, 6 Jun 2010 21:38:55 -0700
make PollManager delay an instance variable
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
@@ -28,9 +28,8 @@ num_inbox_total_unread: the total number of unread messages in the inbox
only those messages appearing in the inbox
EOS
- DELAY = $config[:poll_interval] || 300
-
def initialize
+ @delay = $config[:poll_interval] || 300
@mutex = Mutex.new
@thread = nil
@last_poll = nil
@@ -83,8 +82,8 @@ EOS
def start
@thread = Redwood::reporting_thread("periodic poll") do
while true
- sleep DELAY / 2
- poll if @last_poll.nil? || (Time.now - @last_poll) >= DELAY
+ sleep @delay / 2
+ poll if @last_poll.nil? || (Time.now - @last_poll) >= @delay
end
end
end