Sha256: 94a1e71c1a47044e46a453474710a0679c74fc1e9955e8bbbbf43ed64e2a3fc7

Contents?: true

Size: 502 Bytes

Versions: 7

Compression:

Stored size: 502 Bytes

Contents

require 'rubygems'
#require 'gearman'
require '../lib/gearman'

servers = ['localhost:4730',]
w = Gearman::Worker.new(servers)

# 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 = data
 (1..seconds.to_i).each do |i|
   sleep 1
   print i
   # Report our progress to the job server every second.
   job.report_status(i, seconds)
 end
 # Report success.
 true
end
loop { w.work }

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gearman-ruby-3.0.8 examples/worker.rb
gearman-ruby-3.0.7 examples/worker.rb
gearman-ruby-3.0.6 examples/worker.rb
gearman-ruby-3.0.4 examples/worker.rb
gearman-ruby-3.0.3 examples/worker.rb
gearman-ruby-3.0.2 examples/worker.rb
gearman-ruby-3.0.1 examples/worker.rb