Skip to content

Commit

Permalink
Add unsafe capsule and reports_creator queue with concncurrency of 1
Browse files Browse the repository at this point in the history
  • Loading branch information
jsugarman committed Dec 20, 2024
1 parent 0c5d8f4 commit bcfddd8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/workers/reports_creator_worker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class ReportsCreatorWorker
include Sidekiq::Worker
include Sidekiq::Status::Worker
sidekiq_options queue: :reports_creator

def perform(legal_aid_application_id)
legal_aid_application = LegalAidApplication.find(legal_aid_application_id)
Expand Down
6 changes: 6 additions & 0 deletions config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
# accepts :expiration (optional)
Sidekiq::Status.configure_client_middleware config, expiration: 30.minutes.to_i

config.capsule("unsafe") do |cap|
cap.concurrency = 1
cap.queues = %w[reports_creator] # strict priority
# cap.queues = %w[queue_a,3 queue_b,1] # weighted
end

if Rails.env.production? && Rails.configuration.x.kubernetes_deployment
config.server_middleware do |chain|
Rails.logger.info "[SidekiqPrometheusExporter] Chaining middleware..."
Expand Down
1 change: 1 addition & 0 deletions config/sidekiq.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
:queues:
- reports_creator
- default
- mailers
- active_storage_analysis
Expand Down

0 comments on commit bcfddd8

Please sign in to comment.