I solved the problem with this. 

The problem was that the initialize method was getting called by merb
spawner and in that method I was connecting to RabbitMQ. 

The call method was being executed by the workers these inherited the
socket connection from spawner. 

I was in effect sending messages from multiple different processes
across the same socket to RabbitMQ: it doesn't like this.


A similar problem could face anyone creating a socket connection in
initialize and then using in in call.


Chris




On Wed, 2009-08-26 at 08:27 -0700, Chris McCauley wrote:
> Hi,
> 
> This is a question about how Merb interacts with Rack middleware.
> 
> Given a rack.rb file and a line like
> 
> use MyProfiler
> 
> 
> Does anyone know when the associated class gets instantiated?
> 
> Does it get done before or after the worker processes are forked?
> 
> I ask because I'm using a messaging gem (bunny) within MyProfiler and
> the behaviour is different depending on whether I initialise it from
> initialize(app) or during call(env) in the MyProfiler class.It looks
> like initialize(app) is being called by the spawner or master and the
> call(env) is getting called - unsurprisingly - by the workers.
> 
> Thanks for any input
> 
> Chris
> > 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to