diaspora/app/models/jobs/http_multi.rb
danielgrippi c9f069d000 Revert "add participant_users to conversations"
This reverts commit 655558cb95.

Revert "MS DG; for real this time?"

This reverts commit f85a047f6f.

Revert "MS DG; actually fix the bug"

This reverts commit cde12ec232.

Revert "fix small commenting email bug #oops"

This reverts commit a552fc80c0.

Revert "dont ban diasporahq  stuff"

This reverts commit 2c12b94e67.

Revert "Merge branch 'participants'"

This reverts commit 7417801886, reversing
changes made to abd211ba72.
2011-11-05 18:08:32 -07:00

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