Sha256: c56c8522a14cd18d6c1f5f31291163f6a6e490b46e13bbd5ce458f63b235ca2a

Contents?: true

Size: 737 Bytes

Versions: 7

Compression:

Stored size: 737 Bytes

Contents

#!/usr/bin/env ruby

# Client using Gearman SUBMIT_JOB_EPOCH (currently requires the gearmand branch lp:~jewart/gearmand/scheduled_jobs_support/)

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

(1..100).each do 
   # Connect to the local server (at the default port 4730) 
   client = Gearman::Client.new('localhost')
   taskset = Gearman::TaskSet.new(client)

   data = rand(36**8).to_s(36)
   # Set scheduled time to some time in the future
   time = Time.now() + rand(10)
   puts "Time as seconds: #{time.to_i}" 
   task = Gearman::Task.new("reverse_string", data)
   task.schedule(time)

   # Sending the task to the server
   puts "[client] Sending task: #{task.inspect}, to the 'reverse_string' worker"
   taskset.add_task(task)
end

Version data entries

7 entries across 7 versions & 1 rubygems

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