diff --git a/src/api-umbrella/web-app/config/initializers/delayed_job.rb b/src/api-umbrella/web-app/config/initializers/delayed_job.rb index cae8a5f3f..07bf06989 100644 --- a/src/api-umbrella/web-app/config/initializers/delayed_job.rb +++ b/src/api-umbrella/web-app/config/initializers/delayed_job.rb @@ -1,3 +1,13 @@ +# Exit immediately when the delayed_job process receives a kill signal. +# +# This prevents some race conditions that can lead to API Umbrella stopping +# taking a long time. If mongo is running on the same server and mongo exits +# first, then without exiting immediately, delayed_job can get stuck waiting +# for a new mongo primary (until the 30s server_selection_timeout is hit) +# before exiting. +Delayed::Worker.raise_signal_exceptions = true + +# Keep failed jobs in the database. Delayed::Worker.destroy_failed_jobs = false if(Rails.env.test?)