This reverts commit655558cb95. Revert "MS DG; for real this time?" This reverts commitf85a047f6f. Revert "MS DG; actually fix the bug" This reverts commitcde12ec232. Revert "fix small commenting email bug #oops" This reverts commita552fc80c0. Revert "dont ban diasporahq stuff" This reverts commit2c12b94e67. Revert "Merge branch 'participants'" This reverts commit7417801886, reversing changes made toabd211ba72.
45 lines
1.3 KiB
Ruby
45 lines
1.3 KiB
Ruby
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
|
# licensed under the Affero General Public License version 3 or later. See
|
|
# the COPYRIGHT file.
|
|
|
|
require 'uri'
|
|
require 'resque-retry'
|
|
require File.join(Rails.root, 'lib/hydra_wrapper')
|
|
|
|
module Jobs
|
|
class HttpMulti < Base
|
|
extend Resque::Plugins::ExponentialBackoff
|
|
|
|
@queue = :http
|
|
@backoff_strategy = [10.minutes,
|
|
3.hours,
|
|
12.hours,
|
|
2.days]
|
|
|
|
def self.args_for_retry(user_id, encoded_object_xml, person_ids, dispatcher_class_as_string)
|
|
[user_id, encoded_object_xml, @failed_people, dispatcher_class_as_string]
|
|
end
|
|
|
|
def self.perform(user_id, encoded_object_xml, person_ids, dispatcher_class_as_string)
|
|
user = User.find(user_id)
|
|
people = Person.where(:id => person_ids)
|
|
|
|
dispatcher = dispatcher_class_as_string.constantize
|
|
hydra = HydraWrapper.new(user, people, encoded_object_xml, dispatcher)
|
|
|
|
hydra.enqueue_batch
|
|
hydra.run
|
|
|
|
@failed_people = hydra.failed_people
|
|
|
|
unless @failed_people.empty?
|
|
if self.retry_limit_reached?
|
|
msg = "event=http_multi_abandon sender_id=#{user_id} failed_recipient_ids='[#{@failed_people.join(', ')}]'"
|
|
Rails.logger.info(msg)
|
|
else
|
|
raise 'retry'
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|