Topic: How to run multiple background workers for one request?

Hi, can somebody please recommend how to deal with the following:

I have Rails app where a background process is being activated from user's request. Now I just have 1 Resque worker intercepting request and doing all the work in the background. So the flow is the following:

1) User request -> 2) Resque worker : API calls (1...10) DB update, data manipulation -> return.

I want something like:

1) User request -> 2) Resque worker_1 : API calls (1-> Resque worker_2, 2-> Resque worker_3... etc..), 3) Resque worker_1 : DB update, -> return

So now when worker_2 & worker_3 etc.. are finished, I want worker_1 to run in the background and check if the database is updated..

So in pseudo code it's:

Worker_1:
def process_request
  request.each do |variable|
  #HERE I START NEW PROCESSES FOR NEW WORKERS:
     new_worker.process(variable)
  end
check_database
end


def check_database
   if !database.updated?
     check_database
   else
     final_processing
    end
end

def final_processing
package_and_return_results
end
I keep getting