how to continuously deploy with long running jobs

Viewed 628

We currently use delayed_job and rails to manage some long running jobs in our system. Some of these jobs take potentially hours to run, but we also like to deploy rather frequently, often many times a day. The problem with this setup is that we have to restart delayed_job during deployment to pick up code changes, so that any new jobs are processed with the latest code.

The solution we've arrived at is that for any job that needs to run for more than some small amount of time, we fork the delayed job so that it returns immediately, and the forked process handles the work. This way a deploy can restart all the delayed job processes, while the long-running 'job' keeps going until it's finished as an orphaned process.

We've looked at sidekiq, but it looks like we'd have the same issue there when trying to deploy new code.

Has anyone developed a solution they would recommend for dealing with long-running background processes that span multiple deployments?

0 Answers
Related