examples/worker.rb in gearman-ruby-4.0.3 vs examples/worker.rb in gearman-ruby-4.0.4
- old
+ new
@@ -8,10 +8,10 @@
logger = Logger.new(STDOUT)
# Add a handler for a "sleep" function that takes a single argument, the
# number of seconds to sleep before reporting success.
w.add_ability("sleep") do |data,job|
- seconds = 10
+ seconds = data.to_i
logger.info "Sleeping for #{seconds} seconds"
(1..seconds.to_i).each do |i|
sleep 1
# Report our progress to the job server every second.
job.report_status(i, seconds)