Commit 04d8f2f0 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'qa-fix-transient-geo-log-cursor-error' into 'master'

Add break clause to log cursor processing

Closes #196044

See merge request gitlab-org/gitlab!24918
parents 8b5f1fc2 6f9e1118
...@@ -48,7 +48,11 @@ module Gitlab ...@@ -48,7 +48,11 @@ module Gitlab
# Wrap this with the connection to make it possible to reconnect if # Wrap this with the connection to make it possible to reconnect if
# PGbouncer dies: https://github.com/rails/rails/issues/29189 # PGbouncer dies: https://github.com/rails/rails/issues/29189
ActiveRecord::Base.connection_pool.with_connection do ActiveRecord::Base.connection_pool.with_connection do
LogCursor::EventLogs.new.fetch_in_batches { |batch, last_id| handle_events(batch, last_id) } LogCursor::EventLogs.new.fetch_in_batches do |batch, last_id|
break if exit?
handle_events(batch, last_id)
end
end end
end end
......
...@@ -136,6 +136,15 @@ describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state do ...@@ -136,6 +136,15 @@ describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state do
daemon.find_and_handle_events! daemon.find_and_handle_events!
end end
it 'exits when told to stop' do
allow_any_instance_of(::Gitlab::Geo::LogCursor::EventLogs).to receive(:fetch_in_batches)
allow(daemon).to receive(:exit?).and_return(true)
expect(daemon).not_to receive(:handle_events)
daemon.find_and_handle_events!
end
end end
context 'when node has namespace restrictions' do context 'when node has namespace restrictions' do
......
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