Commit bd778fbd authored by Gabriel Mazetto's avatar Gabriel Mazetto

Make sure NotifyNodesService doesn't fail silently

parent facffd59
...@@ -50,7 +50,7 @@ class GeoNode < ActiveRecord::Base ...@@ -50,7 +50,7 @@ class GeoNode < ActiveRecord::Base
end end
def notify_url def notify_url
URI::join(uri, "#{uri.path}/", 'api/geo/refresh_projects').to_s URI::join(uri, "#{uri.path}/", 'api/v3/geo/refresh_projects').to_s
end end
private private
......
...@@ -39,12 +39,12 @@ module Geo ...@@ -39,12 +39,12 @@ module Geo
private private
def notify_updated_projects(node, projects) def notify_updated_projects(node, projects)
self.class.post(node.notify_url, response = self.class.post(node.notify_url,
body: { projects: projects }.to_json, body: { projects: projects }.to_json,
headers: { headers: {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'PRIVATE-TOKEN' => private_token 'PRIVATE-TOKEN' => private_token
}) })
return [(response.code >= 200 && response.code < 300), ActionView::Base.full_sanitizer.sanitize(response.to_s)] return [(response.code >= 200 && response.code < 300), ActionView::Base.full_sanitizer.sanitize(response.to_s)]
rescue HTTParty::Error, Errno::ECONNREFUSED => e rescue HTTParty::Error, Errno::ECONNREFUSED => e
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment