From a9444caf1f0b47004815ff3bc6af30311b173f7a Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 29 Aug 2025 09:39:48 +0200 Subject: [PATCH] Add a "backend" queue with less priorities for deliveries --- app/jobs/notification/bundle/deliver_all_job.rb | 2 ++ app/jobs/notification/bundle/deliver_job.rb | 2 ++ app/jobs/push_notification_job.rb | 2 -- config/queue.yml | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/jobs/notification/bundle/deliver_all_job.rb b/app/jobs/notification/bundle/deliver_all_job.rb index d2df254f8..250b53b6e 100644 --- a/app/jobs/notification/bundle/deliver_all_job.rb +++ b/app/jobs/notification/bundle/deliver_all_job.rb @@ -1,4 +1,6 @@ class Notification::Bundle::DeliverAllJob < ApplicationJob + queue_as :backend + def perform ApplicationRecord.with_each_tenant do |tenant| Notification::Bundle.deliver_all diff --git a/app/jobs/notification/bundle/deliver_job.rb b/app/jobs/notification/bundle/deliver_job.rb index b4c64a6c2..40e1df479 100644 --- a/app/jobs/notification/bundle/deliver_job.rb +++ b/app/jobs/notification/bundle/deliver_job.rb @@ -1,4 +1,6 @@ class Notification::Bundle::DeliverJob < ApplicationJob + queue_as :backend + def perform(bundle) bundle.deliver end diff --git a/app/jobs/push_notification_job.rb b/app/jobs/push_notification_job.rb index 128cf6a18..124366967 100644 --- a/app/jobs/push_notification_job.rb +++ b/app/jobs/push_notification_job.rb @@ -1,6 +1,4 @@ class PushNotificationJob < ApplicationJob - queue_as :default - def perform(notification) NotificationPusher.new(notification).push end diff --git a/config/queue.yml b/config/queue.yml index 6a199e535..8ae706455 100644 --- a/config/queue.yml +++ b/config/queue.yml @@ -3,7 +3,7 @@ default: &default - polling_interval: 1 batch_size: 500 workers: - - queues: "*" + - queues: [ "default", "backend" ] threads: 3 processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %> polling_interval: 0.1