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
|
# - 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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user