Home > Software design >  Sidekiq Two Default Queues
Sidekiq Two Default Queues

Time:02-10

Both my staging and production apps use the same build command:

bundle exec sidekiq -c 2 -q default -q mailers

The queue names in my staging application match exactly as the build command states:

enter image description here

However, my production application displays as such:

enter image description here

I understand that the prefix for the default comes from my cable.yml:

development:
  adapter: async

test:
  adapter: test

production:
  adapter: redis
  url: <%= ENV["REDIS_URL"] { "redis://localhost:6379/1" } %>
  channel_prefix: calendarize_production

I don't get why there are two defaults and no mailer queue? What am I doing wrong?

CodePudding user response:

The definition of queues for Sidekiq is not done on cable.yml but on sidekiq.yml, here is an example:

:concurrency: 5
:queues:
  - default
  - mailers

staging:
  :queues:
    - ["my_project_staging_default", 3]
    - ["my_project_staging_mailers", 2]
  :tag: STAGING
  :labels:
    - default
    - mailers

production:
  :queues:
    - ["my_project_production_default", 3]
    - ["my_project_production_mailers", 2]
  :concurrency: 5
  :tag: PRODUCTION
  :labels:
    - default
    - mailers

Th risk using default without naming it is to share workers between environments. Then I would suggest to name them so you're 100% sure of what's executing where.

  • Related