Skip to content

Commit 837ca8f

Browse files
committed
Fix api-umbrella process stop sometimes taking a long time.
1 parent 374fa5b commit 837ca8f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/api-umbrella/web-app/config/initializers/delayed_job.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Exit immediately when the delayed_job process receives a kill signal.
2+
#
3+
# This prevents some race conditions that can lead to API Umbrella stopping
4+
# taking a long time. If mongo is running on the same server and mongo exits
5+
# first, then without exiting immediately, delayed_job can get stuck waiting
6+
# for a new mongo primary (until the 30s server_selection_timeout is hit)
7+
# before exiting.
8+
Delayed::Worker.raise_signal_exceptions = true
9+
10+
# Keep failed jobs in the database.
111
Delayed::Worker.destroy_failed_jobs = false
212

313
if(Rails.env.test?)

0 commit comments

Comments
 (0)