Skip to content

Commit

Permalink
Additional logging and handling for missing schedule errors
Browse files Browse the repository at this point in the history
- Hard to track error in integration where the ProcessPostcodeWorker can't affect the backoff service because it can't see the scheduler. Can't replicate on the console, so add a bit of logging and defaults so that Sentry isn't overwhelmed with this odd error.
  • Loading branch information
KludgeKML committed May 16, 2024
1 parent c2e5e2b commit f250fa6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions lib/sidekiq_scheduler_backoff_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ def record_failure
def current_interval
schedule = Sidekiq.get_schedule[name]
Integer(schedule["every"].chop)
rescue StandardError
Rails.logger.error("Queue schedule missing, available schedules: #{Sidekiq.get_schedule.keys.join(", ")}")

Check failure on line 28 in lib/sidekiq_scheduler_backoff_service.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
"1"
end

def restart_schedule(target_interval)
schedule = Sidekiq.get_schedule[name]
Sidekiq.set_schedule(name, schedule.merge("every" => "#{target_interval}s"))
rescue StandardError
Rails.logger.error("Queue schedule missing, available schedules: #{Sidekiq.get_schedule.keys.join(", ")}")

Check failure on line 36 in lib/sidekiq_scheduler_backoff_service.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
end
end

0 comments on commit f250fa6

Please sign in to comment.