Commit e1f14449 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Fix Geo Notify redis operations

parent 5ea39b1c
...@@ -24,13 +24,13 @@ module Geo ...@@ -24,13 +24,13 @@ module Geo
projects = [] projects = []
@redis.multi do @redis.multi do
projects = @redis.lrange(QUEUE, 0, batch_size-1) projects = @redis.lrange(QUEUE, 0, batch_size-1)
@redis.ltrim(QUEUE, 0, batch_size-1) @redis.ltrim(QUEUE, batch_size, -1)
end end
::Gitlab::Geo.secondary_nodes.each do |node| ::Gitlab::Geo.secondary_nodes.each do |node|
success, message = notify_updated_projects(node, projects.value) success, message = notify_updated_projects(node, projects.value)
unless success unless success
Rails.logger.error("Gitlab Failed to notify #{node.url}: #{message}") Rails.logger.error("Gitlab Failed to notify #{node.url} : #{message}")
reenqueue_projects(projects.value) reenqueue_projects(projects.value)
end end
end end
...@@ -39,7 +39,7 @@ module Geo ...@@ -39,7 +39,7 @@ module Geo
private private
def notify_updated_projects(node, projects) def notify_updated_projects(node, projects)
self.post(node.notify_url, 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',
...@@ -47,7 +47,7 @@ module Geo ...@@ -47,7 +47,7 @@ module Geo
}) })
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 => e rescue HTTParty::Error, Errno::ECONNREFUSED => e
return [false, ActionView::Base.full_sanitizer.sanitize(e.message)] return [false, ActionView::Base.full_sanitizer.sanitize(e.message)]
end end
......
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