use obj_str for logging
This commit is contained in:
parent
8ff3062c68
commit
2d4f9a60d5
2 changed files with 10 additions and 10 deletions
|
|
@ -5,12 +5,12 @@ module DiasporaFederation
|
||||||
# Send a public message to all urls
|
# Send a public message to all urls
|
||||||
#
|
#
|
||||||
# @param [String] sender_id sender diaspora-ID
|
# @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<String>] urls receive-urls from pods
|
# @param [Array<String>] urls receive-urls from pods
|
||||||
# @param [String] xml salmon-xml
|
# @param [String] xml salmon-xml
|
||||||
# @return [Array<String>] url to retry
|
# @return [Array<String>] url to retry
|
||||||
def self.public(sender_id, guid, urls, xml)
|
def self.public(sender_id, obj_str, urls, xml)
|
||||||
hydra = HydraWrapper.new(sender_id, guid)
|
hydra = HydraWrapper.new(sender_id, obj_str)
|
||||||
urls.each {|url| hydra.insert_job(url, xml) }
|
urls.each {|url| hydra.insert_job(url, xml) }
|
||||||
hydra.send
|
hydra.send
|
||||||
end
|
end
|
||||||
|
|
@ -18,11 +18,11 @@ module DiasporaFederation
|
||||||
# Send a private message to receive-urls
|
# Send a private message to receive-urls
|
||||||
#
|
#
|
||||||
# @param [String] sender_id sender diaspora-ID
|
# @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)
|
# @param [Hash] targets Hash with receive-urls (key) of peoples with encrypted salmon-xml for them (value)
|
||||||
# @return [Hash] targets to retry
|
# @return [Hash] targets to retry
|
||||||
def self.private(sender_id, guid, targets)
|
def self.private(sender_id, obj_str, targets)
|
||||||
hydra = HydraWrapper.new(sender_id, guid)
|
hydra = HydraWrapper.new(sender_id, obj_str)
|
||||||
targets.each {|url, xml| hydra.insert_job(url, xml) }
|
targets.each {|url, xml| hydra.insert_job(url, xml) }
|
||||||
Hash[hydra.send.map {|url| [url, targets[url]] }]
|
Hash[hydra.send.map {|url| [url, targets[url]] }]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ module DiasporaFederation
|
||||||
# Create a new instance for a message
|
# Create a new instance for a message
|
||||||
#
|
#
|
||||||
# @param [String] sender_id sender diaspora-ID
|
# @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)
|
||||||
def initialize(sender_id, guid)
|
def initialize(sender_id, obj_str)
|
||||||
@sender_id = sender_id
|
@sender_id = sender_id
|
||||||
@guid = guid
|
@obj_str = obj_str
|
||||||
@urls_to_retry = []
|
@urls_to_retry = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ module DiasporaFederation
|
||||||
success = response.success?
|
success = response.success?
|
||||||
DiasporaFederation.callbacks.trigger(:update_pod, pod_url(response.effective_url), 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}"
|
"message=#{response.return_code} code=#{response.response_code} time=#{response.total_time}"
|
||||||
if success
|
if success
|
||||||
logger.info(log_line)
|
logger.info(log_line)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue