Bug somewhere

7 views
Skip to first unread message

Gonzalo Rodríguez-Baltanás Díaz

unread,
Nov 1, 2010, 5:26:02 PM11/1/10
to ruby...@googlegroups.com

Hello

I think there is a bug somewhere or I am doing something wrong O-o Which is weird because it's just copy paste from the examples.

The server should output 20 times the message. But i doesn't do it. Some times it does, some times it doesn't.

If I call the method like *_block then everything is ok. The problem is when is it just the plain call, without waiting for return.

I tried the same code in ruby 1.9 and 1.8 with similar results.

Server:

require "brb"

class ExposedCoreObject
def simple_api_method(parameter)
puts " > Receive #{parameter} in the main ruby process"
end
end

EM::run do # Start event machine
# Start BrB Service, expose an instance of core object to the outside world
BrB::Service.start_service(:object => ExposedCoreObject.new, :host => 'localhost', :port => 5555)
end

Client

require 'brb'
# Create a communication tunnel to the core process
# nil as first parameter as we do not expose any object in exchange

core = BrB::Tunnel.create(nil, "brb://localhost:5555",:verbose => true)
20.times do |t|
core.simple_api_method('20')
end

Guillaume Luccisano

unread,
Nov 1, 2010, 5:41:17 PM11/1/10
to ruby...@googlegroups.com
Hey,

I just made a small test, and it looks like it's because it's too fast and when the client finish to run, it kills the process and the connection to the server, the server notice that and doesn't treat its queue.
Try just by adding a sleep 1 at the end of your client, it will work.

I think BrB is more make for persistent connection :) But this is kind of a bug, I should try to fix it anyway :)

Cheers,
Guillaume

2010/11/1 Gonzalo Rodríguez-Baltanás Díaz <sio...@gmail.com>

Gonzalo Rodríguez-Baltanás Díaz

unread,
Nov 1, 2010, 5:57:25 PM11/1/10
to ruby...@googlegroups.com
Hello!

I understand now :)

Thank you! 
Reply all
Reply to author
Forward
0 new messages