
Show HN: Nectarine, proof of concept parallel processing with Rails Active Job - nate
https://www.rockstarcoders.com/parallel-map/
======
hderms
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?

~~~
nate
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?

~~~
wstuartcl
Timeout::timeout has many very sharp edges you should be aware of before you
use in this context.

~~~
nate
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!

