Sha256: 21b9befe66ef2e0698cc53eee0a5dbbc29fa00656ba94e7cee1f3f79b8300269

Contents?: true

Size: 688 Bytes

Versions: 2

Compression:

Stored size: 688 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'
require '../lib/gearman'
l = Logger.new($stdout)
l.level = Logger::DEBUG
Gearman::Util.logger=l

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

t = nil
threadcounter = 0

client = Gearman::Client.new('192.168.1.1:4730')

  
myid = threadcounter 
threadcounter += 1
taskset = Gearman::TaskSet.new(client)
  
(1..1000).each do |jid|
  data = rand(36**8).to_s(36)
  result = data.reverse

  task = Gearman::BackgroundTask.new("reverse_string", data)
  puts "#{jid} #{data}"
        
  #time = Time.now() + rand(120) + 10
  #task.schedule(time)
  taskset.add_task(task)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gearman-ruby-4.0.3 examples/client_reverse_nohost.rb
gearman-ruby-4.0.2 examples/client_reverse_nohost.rb