Delayed_job should be restarted on production build
Yes, it sounds obvious but it took me some time to figure that out.
We were working on the campaigns downloads in Retiffy. This means generating a PDF for every certificate and then concatenating them into a single PDF and sending the link to the user. Now the problem is that this is done in a delayed_job and if you change the production databases and code without restarting delayed_job, the job preformed at a delay are still using the old code.
We haven`t dig deep enough to understand the internals and whether we could fix it in another way. Currently we are searching for the best solution to restart delayed_job on building production.
This is the initial source of the Ubuntu service that we have come up with. Hope it could help you. We will continue working on it with for restart and stop.
# Delayed job for Retiffy production
# acts as startup service.
# USAGE: start
case “$1″ in
echo “Starting Delayed_job for Retiffy Production”
start-stop-daemon –start –pidfile /var/run/delayed_job.pid –make-pidfile –background –chuid www-data –exec /production/script/delayed_job — restart -i 2 || return 2