[Backgroundrb-devel] Logging & Threading

hemant kumar gethemant at gmail.com
Fri Dec 14 12:07:58 EST 2007


On Fri, 2007-12-14 at 10:42 -0600, Josh Symonds wrote:
> Hey again,
> After playing with BackgrounDRb a bit longer, I have two more issues
> I'd like to bring up with it.
> 1. Logging... it seems like even when the environment is set to
> production in both Mongrel and the backgroundrb.yml file, all
> ActiveRecord SQL statements are written to the development log. If
> you're doing a lot of ActiveRecord stuff in your workers, then the
> development log can get extremely large. I'm not sure why this is
> happening -- is this a bug in BackgrounDRb, or maybe something I
> misconfigured in Rails? It doesn't do this at any other times though. 

This is fixed now. I will be pushing a release that addresses this

> 2. Threads. Hemant, you said you were going to change how BackgrounDRb
> handles threads. But what do we do for now if we want a worker to do a
> process without blocking? I try using threads for this and get
> constant errors in the server until it finally crashes. 

I did some tests with threads it seems to work. In my apps, I don't need
threads and hence my tests may be trivial, but can you be specific and
let me know about the errors that you got?

If possible, paste the code as well so as I can see how you are using
threads? Basically I was going to add a thread pool within bdrb itself
so as:

  Bdrb.defer { your_long_task }

So as, whatever you do in block would run in a new thread, and once
processing is done, the thread is returned to pool.

Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.


More information about the Backgroundrb-devel mailing list