Skip to content

Commit

Permalink
Respect the configured execution mode, even within the CLI (#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
bensheldon committed Aug 30, 2023
1 parent 80b20fb commit 1a70248
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/good_job/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,24 @@ def validate!
# for more details on possible values.
# @return [Symbol]
def execution_mode
mode = if GoodJob::CLI.within_exe?
:external
else
options[:execution_mode] ||
rails_config[:execution_mode] ||
env['GOOD_JOB_EXECUTION_MODE']
end
mode = options[:execution_mode] ||
rails_config[:execution_mode] ||
env['GOOD_JOB_EXECUTION_MODE']
mode = mode.to_sym if mode

if mode
mode.to_sym
if GoodJob::CLI.within_exe? && [:async, :async_server].include?(mode)
:external
else
mode
end
elsif GoodJob::CLI.within_exe?
:external
elsif Rails.env.development?
:async
elsif Rails.env.test?
:inline
else
else # rubocop:disable Lint/DuplicateBranch
:external
end
end
Expand Down

0 comments on commit 1a70248

Please sign in to comment.