From bfddc4da24eedbfb03f0c477f30e4f0886ba8c07 Mon Sep 17 00:00:00 2001 From: Vishnu Narayanan Date: Thu, 8 May 2025 09:39:49 +0530 Subject: [PATCH] chore: use housekeeping queue for remove_stale_contacts job (#11435) - Use the housekeeping queue for the `remove_stale_contacts` job - fix specs --- app/jobs/internal/remove_stale_contacts_job.rb | 2 +- spec/jobs/internal/process_stale_contacts_job_spec.rb | 8 ++++---- spec/jobs/internal/remove_stale_contacts_job_spec.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/jobs/internal/remove_stale_contacts_job.rb b/app/jobs/internal/remove_stale_contacts_job.rb index 3c33fd245..4091af44a 100644 --- a/app/jobs/internal/remove_stale_contacts_job.rb +++ b/app/jobs/internal/remove_stale_contacts_job.rb @@ -5,7 +5,7 @@ # - are older than 30 days class Internal::RemoveStaleContactsJob < ApplicationJob - queue_as :low + queue_as :housekeeping def perform(account, batch_size = 1000) Internal::RemoveStaleContactsService.new(account: account).perform(batch_size) diff --git a/spec/jobs/internal/process_stale_contacts_job_spec.rb b/spec/jobs/internal/process_stale_contacts_job_spec.rb index 412ee06cc..f7f17bf78 100644 --- a/spec/jobs/internal/process_stale_contacts_job_spec.rb +++ b/spec/jobs/internal/process_stale_contacts_job_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Internal::ProcessStaleContactsJob do it 'enqueues the job' do allow(ChatwootApp).to receive(:chatwoot_cloud?).and_return(true) expect { job }.to have_enqueued_job(described_class) - .on_queue('scheduled_jobs') + .on_queue('housekeeping') end it 'enqueues RemoveStaleContactsJob for each account' do @@ -17,13 +17,13 @@ RSpec.describe Internal::ProcessStaleContactsJob do expect { described_class.perform_now }.to have_enqueued_job(Internal::RemoveStaleContactsJob) .with(account1) - .on_queue('low') + .on_queue('housekeeping') expect { described_class.perform_now }.to have_enqueued_job(Internal::RemoveStaleContactsJob) .with(account2) - .on_queue('low') + .on_queue('housekeeping') expect { described_class.perform_now }.to have_enqueued_job(Internal::RemoveStaleContactsJob) .with(account3) - .on_queue('low') + .on_queue('housekeeping') end it 'processes accounts in batches' do diff --git a/spec/jobs/internal/remove_stale_contacts_job_spec.rb b/spec/jobs/internal/remove_stale_contacts_job_spec.rb index ea2636114..373fc5867 100644 --- a/spec/jobs/internal/remove_stale_contacts_job_spec.rb +++ b/spec/jobs/internal/remove_stale_contacts_job_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Internal::RemoveStaleContactsJob do it 'enqueues the job' do expect { job }.to have_enqueued_job(described_class) .with(account) - .on_queue('low') + .on_queue('housekeeping') end it 'calls the RemoveStaleContactsService' do