▲ 6 points
back
4 comments
Not to be a naysayer but it might be a better effort to prevent having to do a bunch of work before returning a response. Have you considered polling for all the jobs to be completed instead?
Hello. No apologies necessary! Wanted to put this out there for the discussion. So thanks for the comment. I'm not sure what you mean though. This is polling to see if the jobs are completed. Every two seconds it goes and polls the status of each of the Jobs that were kicked off.
Timeout::timeout(15 * 60) do
while(!all_job_statuses_complete?(all_jobs)) do
sleep 2
end
end
Was there something else you were referring to?Timeout::timeout has many very sharp edges you should be aware of before you use in this context.
Very true. Could just as easily just count the number of times we've looped through this and multiply by our sleep to get a sense of time taken place. Thanks for the poke at that!