File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -102,13 +102,14 @@ def validate_queues
102
102
# 2. Work loop: Jobs are pulled from a queue and processed.
103
103
# 3. Teardown: This worker is unregistered.
104
104
#
105
- # Can be passed an integer representing the polling frequency.
105
+ # Can be passed a float representing the polling frequency.
106
106
# The default is 5 seconds, but for a semi-active site you may
107
107
# want to use a smaller value.
108
108
#
109
109
# Also accepts a block which will be passed the job as soon as it
110
110
# has completed processing. Useful for testing.
111
- def work ( interval = 5 , &block )
111
+ def work ( interval = 5.0 , &block )
112
+ interval = interval . to_f
112
113
$0 = "resque: Starting"
113
114
startup
114
115
@@ -133,10 +134,10 @@ def work(interval = 5, &block)
133
134
done_working
134
135
@child = nil
135
136
else
136
- break if interval . to_i == 0
137
- log! "Sleeping for #{ interval . to_i } "
137
+ break if interval . zero?
138
+ log! "Sleeping for #{ interval } seconds "
138
139
procline @paused ? "Paused" : "Waiting for #{ @queues . join ( ',' ) } "
139
- sleep interval . to_i
140
+ sleep interval
140
141
end
141
142
end
142
143
You can’t perform that action at this time.
0 commit comments