Batched remove status service (#3735)
* Make Pubsubhubbub::DistributionWorker handle both single stream entry arguments, as well as arrays of stream entries * Add BatchedRemoveStatusService, make SuspendAccountService use it * Improve method names * Add test * Add more tests * Use PuSH payloads of 100 to have a clear mapping of 1000 input statuses -> 10 PuSH payloads It was nice while it lasted
This commit is contained in:
parent
4a618908e8
commit
e17c2e5da5
5 changed files with 216 additions and 23 deletions
|
@ -16,10 +16,9 @@ describe Pubsubhubbub::DistributionWorker do
|
|||
let(:status) { Fabricate(:status, account: alice, text: 'Hello', visibility: :public) }
|
||||
|
||||
it 'delivers payload to all subscriptions' do
|
||||
allow(Pubsubhubbub::DeliveryWorker).to receive(:perform_async)
|
||||
allow(Pubsubhubbub::DeliveryWorker).to receive(:push_bulk)
|
||||
subject.perform(status.stream_entry.id)
|
||||
expect(Pubsubhubbub::DeliveryWorker).to have_received(:perform_async).with(subscription_with_follower.id, /.*/)
|
||||
expect(Pubsubhubbub::DeliveryWorker).to have_received(:perform_async).with(anonymous_subscription.id, /.*/)
|
||||
expect(Pubsubhubbub::DeliveryWorker).to have_received(:push_bulk).with([anonymous_subscription, subscription_with_follower])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,10 +26,10 @@ describe Pubsubhubbub::DistributionWorker do
|
|||
let(:status) { Fabricate(:status, account: alice, text: 'Hello', visibility: :private) }
|
||||
|
||||
it 'delivers payload only to subscriptions with followers' do
|
||||
allow(Pubsubhubbub::DeliveryWorker).to receive(:perform_async)
|
||||
allow(Pubsubhubbub::DeliveryWorker).to receive(:push_bulk)
|
||||
subject.perform(status.stream_entry.id)
|
||||
expect(Pubsubhubbub::DeliveryWorker).to have_received(:perform_async).with(subscription_with_follower.id, /.*/)
|
||||
expect(Pubsubhubbub::DeliveryWorker).to_not have_received(:perform_async).with(anonymous_subscription.id, /.*/)
|
||||
expect(Pubsubhubbub::DeliveryWorker).to have_received(:push_bulk).with([subscription_with_follower])
|
||||
expect(Pubsubhubbub::DeliveryWorker).to_not have_received(:push_bulk).with([anonymous_subscription])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,9 +37,9 @@ describe Pubsubhubbub::DistributionWorker do
|
|||
let(:status) { Fabricate(:status, account: alice, text: 'Hello', visibility: :direct) }
|
||||
|
||||
it 'does not deliver payload' do
|
||||
allow(Pubsubhubbub::DeliveryWorker).to receive(:perform_async)
|
||||
allow(Pubsubhubbub::DeliveryWorker).to receive(:push_bulk)
|
||||
subject.perform(status.stream_entry.id)
|
||||
expect(Pubsubhubbub::DeliveryWorker).to_not have_received(:perform_async)
|
||||
expect(Pubsubhubbub::DeliveryWorker).to_not have_received(:push_bulk)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue