On Fri, Apr 01, 2011 at 12:35:03PM +0200, Simone Carletti wrote:
> 
> I'm curious to know the reason behind the following code block
> https://github.com/tosch/ruote-on-rails/blob/rails3/config/initializers/ruote_kit.rb#L40-53
> 
> Why are participant ignored when Rails is started as a rake task?
> Is it a performance improvement or is there any additional reason?

Hello Simone,

first, I'm tempted to change

  unless $RAKE_TASK

to

  unless defined?(Rake)

but well.

This conditional block is meant to prevent participant registration when a rake 
task of the rails app is called.

We simply want to avoid participant re-registration (it's a write operation to 
the storage) except when the application starts up.

In fact, for some applications, you even only want participant registration to 
happen once and only once (first startup).

Also, since the application, when running a rake task, won't be running a 
worker, you don't need to have participants ready (and sometimes if some 
participant implementations do some connection setup at class loading time, you 
really don't want to have them around).

After some thinking, I guess that

  if RuoteKit.engine.no_participant_registered?

might be a better fit (though it's not yet implemented).


Best regards,

-- 
John Mettraux - http://jmettraux.wordpress.com

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to