[Backgroundrb-devel] Determining whether shared code is running in a worker
hemant kumar
gethemant at gmail.com
Sat Sep 13 22:22:50 EDT 2008
Sure,
There are couple of ways:
1. worker_name method will be available inside your worker code and
should be non nil.
2. If inside worker code, you will have access to many worker unique
attributes (like thread_pool), you can check for those and make
conditions.
On Sat, 2008-09-13 at 16:10 -0400, Alan.Hayes at onevision.com wrote:
>
> Hello Hemant et al -
>
> I have a module which is common to my foreground Rails code
> and some of my workers. Is there a way to determine whether I am
> running in a worker? I can't use the session because not all my
> foreground code has a session; some is run as callbacks to the
> foreground and has no session. There may have been a question about
> this in the past, but, if so, I haven't found it. Any suggestions are
> appreciated.
>
> Regards, alan
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
More information about the Backgroundrb-devel
mailing list