Michael Alletto
2009-Jul-30 16:33 UTC
[Backgroundrb-devel] persistent task queues and thread pools
I have enabled persistent task queues and it is working but I want to limit
how many tasks run based on the thread pool.
The task calls inside my worker
def do_work(id)
pool_size 2
thread_pool.defer(:do_ocr, id)
end
the worker then has do_ocr which contains the actual work to be done. I
would like the task queue to check on a 1 second time frame so stuff is
processed as fast as possible, but I do not want more than 2 running at a
time. If I set the persistent_delay to 1 second it launches 1 queued task
each second ignoring the pool_size of 2. Is there anyway to have the
persistent task queue obey the pool_size limit and react the way I expected
it to act? Or have the task queue wake and grab x number of tasks out of
the queue at a time as well as obeying the pool_size on a worker by worker
basis?
I''m using the latest git code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20090730/9bc8fc44/attachment.html>