Skip to content

Commit

Permalink
Remove extraneous changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bensheldon committed Jan 22, 2025
1 parent 4ae7715 commit 109deb1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Available configuration options are:
config.good_job.probe_handler = 'webrick'
```
- `enable_pause` (boolean) whether job processing can be paused. Defaults to `false`. You can also set this with the environment variable `GOOD_JOB_ENABLE_PAUSE`.
- `enable_pauses` (boolean) whether job processing can be paused. Defaults to `false`. You can also set this with the environment variable `GOOD_JOB_ENABLE_PAUSES`.
By default, GoodJob configures the following execution modes per environment:
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/good_job/performance_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ def index
MIN(duration) AS min_duration,
MAX(duration) AS max_duration
").order(:queue_name)

@paused = GoodJob::Setting.paused
@paused_job_classes = @paused[:job_classes]
@paused_queues = @paused[:queues]
end

def show
Expand Down
2 changes: 1 addition & 1 deletion app/models/good_job/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Job < BaseRecord
scope :only_scheduled, -> { where(arel_table['scheduled_at'].lteq(bind_value('scheduled_at', DateTime.current, ActiveRecord::Type::DateTime))).or(where(scheduled_at: nil)) }

# Exclude jobs that are paused via queue_name or job_class.
# Only applies when enable_pause configuration is true.
# Only applies when enable_pauses configuration is true.
# @!method exclude_paused
# @!scope class
# @return [ActiveRecord::Relation]
Expand Down
8 changes: 1 addition & 7 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@
end

resources :processes, only: %i[index]
resources :performance, only: %i[index show] do
collection do
get :pause, to: redirect(path: 'performance')
post :pause
delete :unpause
end
end
resources :performance, only: %i[index show]
resources :pauses, only: %i[index] do
collection do
post :create
Expand Down
8 changes: 4 additions & 4 deletions lib/good_job/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class Configuration
DEFAULT_DASHBOARD_LIVE_POLL_ENABLED = true
# Default enqueue_after_transaction_commit
DEFAULT_ENQUEUE_AFTER_TRANSACTION_COMMIT = false
# Default enable_pause setting
DEFAULT_ENABLE_PAUSE = false
# Default enable_pauses setting
DEFAULT_ENABLE_PAUSES = false

def self.validate_execution_mode(execution_mode)
raise ArgumentError, "GoodJob execution mode must be one of #{EXECUTION_MODES.join(', ')}. It was '#{execution_mode}' which is not valid." unless execution_mode.in?(EXECUTION_MODES)
Expand Down Expand Up @@ -376,9 +376,9 @@ def enqueue_after_transaction_commit
def enable_pauses
return options[:enable_pauses] unless options[:enable_pauses].nil?
return rails_config[:enable_pauses] unless rails_config[:enable_pauses].nil?
return ActiveModel::Type::Boolean.new.cast(env['GOOD_JOB_ENABLE_PAUSE']) unless env['GOOD_JOB_ENABLE_PAUSE'].nil?
return ActiveModel::Type::Boolean.new.cast(env['GOOD_JOB_ENABLE_PAUSES']) unless env['GOOD_JOB_ENABLE_PAUSE'].nil?

DEFAULT_ENABLE_PAUSE
DEFAULT_ENABLE_PAUSES
end

# Whether running in a web server process.
Expand Down
4 changes: 2 additions & 2 deletions spec/app/models/good_job/job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1082,15 +1082,15 @@ def job_params
allow(GoodJob.configuration).to receive(:enable_pauses).and_return(enable_pauses)
end

context 'when enable_pause is false' do
context 'when enable_pauses is false' do
let(:enable_pauses) { false }

it 'returns all jobs' do
expect(described_class.exclude_paused).to contain_exactly(default_job, mailers_job, reports_job, labeled_job, other_labeled_job)
end
end

context 'when enable_pause is true' do
context 'when enable_pauses is true' do
let(:enable_pauses) { true }

it 'returns all jobs when nothing is paused' do
Expand Down

0 comments on commit 109deb1

Please sign in to comment.