diff --git a/lib/diaspora_federation/federation/sender.rb b/lib/diaspora_federation/federation/sender.rb index a392122..39f046e 100644 --- a/lib/diaspora_federation/federation/sender.rb +++ b/lib/diaspora_federation/federation/sender.rb @@ -5,12 +5,12 @@ module DiasporaFederation # Send a public message to all urls # # @param [String] sender_id sender diaspora-ID - # @param [String] guid guid of the object to send (can be nil if the object has no guid) + # @param [String] obj_str object string representation for logging (e.g. type@guid) # @param [Array] urls receive-urls from pods # @param [String] xml salmon-xml # @return [Array] url to retry - def self.public(sender_id, guid, urls, xml) - hydra = HydraWrapper.new(sender_id, guid) + def self.public(sender_id, obj_str, urls, xml) + hydra = HydraWrapper.new(sender_id, obj_str) urls.each {|url| hydra.insert_job(url, xml) } hydra.send end @@ -18,11 +18,11 @@ module DiasporaFederation # Send a private message to receive-urls # # @param [String] sender_id sender diaspora-ID - # @param [String] guid guid of the object to send (can be nil if the object has no guid) + # @param [String] obj_str object string representation for logging (e.g. type@guid) # @param [Hash] targets Hash with receive-urls (key) of peoples with encrypted salmon-xml for them (value) # @return [Hash] targets to retry - def self.private(sender_id, guid, targets) - hydra = HydraWrapper.new(sender_id, guid) + def self.private(sender_id, obj_str, targets) + hydra = HydraWrapper.new(sender_id, obj_str) targets.each {|url, xml| hydra.insert_job(url, xml) } Hash[hydra.send.map {|url| [url, targets[url]] }] end diff --git a/lib/diaspora_federation/federation/sender/hydra_wrapper.rb b/lib/diaspora_federation/federation/sender/hydra_wrapper.rb index f4d9d23..f8b017e 100644 --- a/lib/diaspora_federation/federation/sender/hydra_wrapper.rb +++ b/lib/diaspora_federation/federation/sender/hydra_wrapper.rb @@ -27,10 +27,10 @@ module DiasporaFederation # Create a new instance for a message # # @param [String] sender_id sender diaspora-ID - # @param [String] guid guid of the object to send (can be nil if the object has no guid) - def initialize(sender_id, guid) + # @param [String] obj_str object string representation for logging (e.g. type@guid) + def initialize(sender_id, obj_str) @sender_id = sender_id - @guid = guid + @obj_str = obj_str @urls_to_retry = [] end @@ -64,7 +64,7 @@ module DiasporaFederation success = response.success? DiasporaFederation.callbacks.trigger(:update_pod, pod_url(response.effective_url), success) - log_line = "success=#{success} sender=#{@sender_id} guid=#{@guid} url=#{response.effective_url} " \ + log_line = "success=#{success} sender=#{@sender_id} obj=#{@obj_str} url=#{response.effective_url} " \ "message=#{response.return_code} code=#{response.response_code} time=#{response.total_time}" if success logger.info(log_line)