From 544640d20a04df0765d4e9ed09b7102c43aadad4 Mon Sep 17 00:00:00 2001 From: Vincent Pochet Date: Mon, 18 Nov 2024 17:44:04 +0100 Subject: [PATCH] Add startup logic --- config/queue.yml | 19 ++++++++++++++++--- config/queue_events.yml | 18 ++++++++++++++++++ config/queue_pdfs.yml | 18 ++++++++++++++++++ scripts/start.events.worker.dev.sh | 2 +- scripts/start.pdfs.worker.dev.sh | 2 +- scripts/start.worker.dev.sh | 3 +-- 6 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 config/queue_events.yml create mode 100644 config/queue_pdfs.yml diff --git a/config/queue.yml b/config/queue.yml index 9eace59c41e..66bb48adcca 100644 --- a/config/queue.yml +++ b/config/queue.yml @@ -3,10 +3,23 @@ default: &default - polling_interval: 1 batch_size: 500 workers: - - queues: "*" - threads: 3 - processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %> + - queues: + - default + - mailers + - clock + - providers + - billing + - webhook + - invoices + - wallets + - integrations + threads: <%= ENV.fetch("JOB_CONCURRENCY", 10) %> + processes: 1 polling_interval: 0.1 + - queues: "low_priority" + threads: <%= ENV.fetch("JOB_CONCURRENCY", 10) %> + processes: 1 + polling_interval: 3 development: <<: *default diff --git a/config/queue_events.yml b/config/queue_events.yml new file mode 100644 index 00000000000..1d25db24396 --- /dev/null +++ b/config/queue_events.yml @@ -0,0 +1,18 @@ +default: &default + dispatchers: + - polling_interval: 1 + batch_size: 500 + workers: + - queues: "events" + threads: 3 + processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %> + polling_interval: 0.1 + +development: + <<: *default + +test: + <<: *default + +production: + <<: *default diff --git a/config/queue_pdfs.yml b/config/queue_pdfs.yml new file mode 100644 index 00000000000..9a69c3ad6f8 --- /dev/null +++ b/config/queue_pdfs.yml @@ -0,0 +1,18 @@ +default: &default + dispatchers: + - polling_interval: 1 + batch_size: 500 + workers: + - queues: "pdfs" + threads: 3 + processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %> + polling_interval: 3 + +development: + <<: *default + +test: + <<: *default + +production: + <<: *default diff --git a/scripts/start.events.worker.dev.sh b/scripts/start.events.worker.dev.sh index 7bd0c93aad9..e9f82f34b9d 100755 --- a/scripts/start.events.worker.dev.sh +++ b/scripts/start.events.worker.dev.sh @@ -1,4 +1,4 @@ #!/bin/bash bundle install -bundle exec sidekiq -C config/sidekiq_events.yml +bin/jobs -c config/queue_events.yml diff --git a/scripts/start.pdfs.worker.dev.sh b/scripts/start.pdfs.worker.dev.sh index ccef433c47d..9dfbb74c61c 100755 --- a/scripts/start.pdfs.worker.dev.sh +++ b/scripts/start.pdfs.worker.dev.sh @@ -1,4 +1,4 @@ #!/bin/bash bundle install -bundle exec sidekiq -C config/sidekiq_pdfs.yml +bin/jobs -c config/queue_pdfs.yml diff --git a/scripts/start.worker.dev.sh b/scripts/start.worker.dev.sh index ae6e691a469..fb826edc3b1 100755 --- a/scripts/start.worker.dev.sh +++ b/scripts/start.worker.dev.sh @@ -1,6 +1,5 @@ #!/bin/bash bundle install -#bundle exec sidekiq -C config/sidekiq.yml -bundle exec rake solid_queue:start +bin/jobs -c config/queue.yml