Skip to content

Commit 66ec67e

Browse files
Modify good-job related configuration
- Ensure development is in async mode - Currently default is external - No longer need to load good-job workers with puma on user-facing servers
1 parent 6213d5d commit 66ec67e

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

config/environments/development.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@
8181
# Prevent health checks from clogging up the logs.
8282
config.silence_healthcheck_path = "/up"
8383

84+
# Set up GoodJob for async execution in development mode
85+
config.good_job.execution_mode = :async
86+
8487
# Enable strict loading to catch N+1 problems.
8588
config.active_record.strict_loading_by_default = true
8689
config.active_record.strict_loading_mode = :n_plus_one_only

config/puma.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,5 @@
5757
# processes).
5858
workers Settings.web_concurrency
5959

60-
if Settings.web_concurrency > 1
61-
# Cleanly shut down GoodJob when Puma is shut down.
62-
# See https://github.com/bensheldon/good_job#execute-jobs-async--in-process
63-
MAIN_PID = Process.pid
64-
before_fork { GoodJob.shutdown }
65-
on_worker_boot { GoodJob.restart }
66-
on_worker_shutdown { GoodJob.shutdown }
67-
at_exit { GoodJob.shutdown if Process.pid == MAIN_PID }
68-
69-
# Use the `preload_app!` method when specifying a `workers` number.
70-
# This directive tells Puma to first boot the application and load code
71-
# before forking the application. This takes advantage of Copy On Write
72-
# process behavior so workers use less memory.
73-
preload_app!
74-
end
75-
7660
# Re-open appenders after forking the process; needed for Semantic Logger
7761
on_worker_boot { SemanticLogger.reopen }

0 commit comments

Comments
 (0)