mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
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:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user