chore: use housekeeping queue for remove_stale_contacts job (#11435)

- Use the housekeeping queue for the `remove_stale_contacts` job
- fix specs
This commit is contained in:
Vishnu Narayanan
2025-05-08 09:39:49 +05:30
committed by GitHub
parent 199f2fb86c
commit bfddc4da24
3 changed files with 6 additions and 6 deletions

View File

@@ -5,7 +5,7 @@
# - are older than 30 days # - are older than 30 days
class Internal::RemoveStaleContactsJob < ApplicationJob class Internal::RemoveStaleContactsJob < ApplicationJob
queue_as :low queue_as :housekeeping
def perform(account, batch_size = 1000) def perform(account, batch_size = 1000)
Internal::RemoveStaleContactsService.new(account: account).perform(batch_size) Internal::RemoveStaleContactsService.new(account: account).perform(batch_size)

View File

@@ -6,7 +6,7 @@ RSpec.describe Internal::ProcessStaleContactsJob do
it 'enqueues the job' do it 'enqueues the job' do
allow(ChatwootApp).to receive(:chatwoot_cloud?).and_return(true) allow(ChatwootApp).to receive(:chatwoot_cloud?).and_return(true)
expect { job }.to have_enqueued_job(described_class) expect { job }.to have_enqueued_job(described_class)
.on_queue('scheduled_jobs') .on_queue('housekeeping')
end end
it 'enqueues RemoveStaleContactsJob for each account' do 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) expect { described_class.perform_now }.to have_enqueued_job(Internal::RemoveStaleContactsJob)
.with(account1) .with(account1)
.on_queue('low') .on_queue('housekeeping')
expect { described_class.perform_now }.to have_enqueued_job(Internal::RemoveStaleContactsJob) expect { described_class.perform_now }.to have_enqueued_job(Internal::RemoveStaleContactsJob)
.with(account2) .with(account2)
.on_queue('low') .on_queue('housekeeping')
expect { described_class.perform_now }.to have_enqueued_job(Internal::RemoveStaleContactsJob) expect { described_class.perform_now }.to have_enqueued_job(Internal::RemoveStaleContactsJob)
.with(account3) .with(account3)
.on_queue('low') .on_queue('housekeeping')
end end
it 'processes accounts in batches' do it 'processes accounts in batches' do

View File

@@ -8,7 +8,7 @@ RSpec.describe Internal::RemoveStaleContactsJob do
it 'enqueues the job' do it 'enqueues the job' do
expect { job }.to have_enqueued_job(described_class) expect { job }.to have_enqueued_job(described_class)
.with(account) .with(account)
.on_queue('low') .on_queue('housekeeping')
end end
it 'calls the RemoveStaleContactsService' do it 'calls the RemoveStaleContactsService' do