From 7bb412c6083e146ac5439c59346f7f8771b49daf Mon Sep 17 00:00:00 2001 From: Earlopain Date: Sat, 15 Apr 2023 21:07:52 +0200 Subject: [PATCH] [Prod] Configure sidekiq through env variables --- Procfile | 2 +- config/sidekiq.yml | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Procfile b/Procfile index 00645ec15..4e618cbf7 100644 --- a/Procfile +++ b/Procfile @@ -1,4 +1,4 @@ server: bin/rails server -p 9000 -b 0.0.0.0 # server: bundle exec unicorn -c config/unicorn/development.rb -jobs: bundle exec sidekiq -c 1 -q low_prio -q tags -q default -q high_prio -q video +jobs: SIDEKIQ_QUEUES="low_prio:1;tags:2;default:3;high_prio:5" bundle exec sidekiq cron: run-parts /etc/periodic/daily && crond -f diff --git a/config/sidekiq.yml b/config/sidekiq.yml index e2c776101..73eb9529d 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -1,6 +1,5 @@ --- :verbose: false -:concurrency: 5 # Set timeout to 8 on Heroku, longer if you manage your own systems. :timeout: 30 @@ -9,11 +8,8 @@ # even put in dynamic logic, like a host-specific queue. # http://www.mikeperham.com/2013/11/13/advanced-sidekiq-host-specific-queues/ :queues: - - [low_prio, 1] - - [tags, 2] - - [default, 3] - - [high_prio, 5] +<% ENV.fetch("SIDEKIQ_QUEUES").split(";").map { |e| e.split(":") }.each do |queue, priority| %> + - [<%= queue %>, <%= priority %>] +<% end %> -# you can override concurrency based on environment -production: - :concurrency: 15 +:concurrency: <%= ENV.fetch("SIDEKIQ_CONCURRENCY", 5) %>