Hi
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.