Use the new local batch receive job

This commit is contained in:
Raphael Sofaer 2011-03-17 13:41:30 -07:00
parent 52691920f7
commit 0aa5193434
2 changed files with 6 additions and 6 deletions

View file

@ -44,10 +44,10 @@ class Postzord::Dispatch
end
def deliver_to_local(people)
people.each do |person|
Rails.logger.info("event=push_to_local_person route=local sender=#{@sender_person.diaspora_handle} recipient=#{person.diaspora_handle} payload_type=#{@object.class}")
Resque.enqueue(Job::Receive, person.owner_id, @xml, @sender_person.id)
end
return if people.blank?
ids = people.map{ |p| p.owner_id }
Resque.enqueue(Job::ReceiveLocalBatch, @object.id, ids)
Rails.logger.info("event=push route=local sender=#{@sender_person.diaspora_handle} recipients=#{ids.join(',')} payload_type=#{@object.class}")
end
def deliver_to_hub

View file

@ -234,11 +234,11 @@ describe Postzord::Dispatch do
end
describe '#deliver_to_local' do
it 'sends each person an object' do
it 'queues a batch receive' do
local_people = []
local_people << @user.person
mailman = Postzord::Dispatch.new(@user, @sm)
Resque.should_receive(:enqueue).with(Job::Receive, @user.id, @xml, anything).once
Resque.should_receive(:enqueue).with(Job::ReceiveLocalBatch, @sm.id, [@user.id]).once
mailman.send(:deliver_to_local, local_people)
end
end