# Backgroundrb Question

**URL:** <https://www.ruby-forum.com/t/backgroundrb-question/123970>\
**Category:** Rails\
**Created:** [December 22, 2007, 10:35pm UTC](https://www.ruby-forum.com/t/backgroundrb-question/123970 "2007-12-22T22:35:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xgamerx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/d2c977/32.png) [@xgamerx](https://www.ruby-forum.com/u/xgamerx)\
**Post date:** [December 22, 2007, 10:35pm UTC](https://www.ruby-forum.com/t/backgroundrb-question/123970/1 "2007-12-22T22:35:23Z")

</div>

If I have a worker and everything set up and I call:

MiddleMan.ask\_status(:worker =\> :foo\_worker)  
MiddleMan.ask\_status(:worker =\> :foo\_worker)  
MiddleMan.ask\_status(:worker =\> :foo\_worker)

three times in quick succession. Will the tasks be queued up and  
executed as the previous one finishes? Or is this going to ignore the 2  
bottom requests? How does this work?

Do I absolutely need to set job\_keys in the situation in which the  
worker may be called by multiple users at once?

---

<div class="post-metadata">

**Author:** ![xgamerx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/d2c977/32.png) [@xgamerx](https://www.ruby-forum.com/u/xgamerx)\
**Post date:** [December 23, 2007, 2:15am UTC](https://www.ruby-forum.com/t/backgroundrb-question/123970/2 "2007-12-23T02:15:29Z")

</div>

Hi

On Dec 23, 2007 3:05 AM, Nathan E.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> If I have a worker and everything set up and I call:
> 
> MiddleMan.ask\_status(:worker =\> :foo\_worker)  
> MiddleMan.ask\_status(:worker =\> :foo\_worker)  
> MiddleMan.ask\_status(:worker =\> :foo\_worker)

You are not asking a worker to do something, you are just asking the  
status and it won’t hit the worker at all. Perhaps you meant:

MiddleMan.ask\_work(:worker =\> :foo\_worker, :worker\_method =\>  
:send\_mails, :data =\> @selected\_users.map(&:id))

> three times in quick succession. Will the tasks be queued up and  
> executed as the previous one finishes? Or is this going to ignore the 2  
> bottom requests? How does this work?
> 
> Do I absolutely need to set job\_keys in the situation in which the  
> worker may be called by multiple users at once?

Depends on, how you want to handle it. If you want the requests to be  
queued when multiple users hit it, you don’t have to do anything and  
your requests will be queued by default.

But, if you want to process them concurrently, then you can use  
inbuilt thread pool. You can join backgroundrb mailing list for more  
information.

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

[http://gnufied.org](http://gnufied.org)
