examples/echo_client.rb in pigato-0.4.5 vs examples/echo_client.rb in pigato-0.4.6
- old
+ new
@@ -6,21 +6,22 @@
require 'thread'
def start
ts = []
- (0..10).each do |tid|
+ (0..5).each do |tid|
ts << Thread.new {
client = Pigato::Client.new('tcp://127.0.0.1:55555', { :autostart => true, :timeout => 20000 })
- requests = 1000
+ requests = 50000
success = 0
d1 = Time.now
requests.times do |i|
begin
- res = client.request('echo', 'Hello world1')
- if res
+ sw = "Hello world #{i}"
+ res = client.request('echo', sw)
+ if res == sw
success += 1
else
puts "nil reply"
end
end
@@ -33,10 +34,10 @@
ts.each do |to|
to.join
end
end
-(0..4).each do |pid|
+(0..2).each do |pid|
pid = fork do
start
end
end