Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c57622a2
Commit
c57622a2
authored
Aug 09, 2019
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Use sleep_break instead in the log_cursor
parent
0fe56995
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
ee/lib/gitlab/geo/log_cursor/daemon.rb
ee/lib/gitlab/geo/log_cursor/daemon.rb
+9
-1
ee/spec/lib/gitlab/geo/log_cursor/daemon_spec.rb
ee/spec/lib/gitlab/geo/log_cursor/daemon_spec.rb
+3
-3
No files found.
ee/lib/gitlab/geo/log_cursor/daemon.rb
View file @
c57622a2
...
...
@@ -21,7 +21,7 @@ module Gitlab
until
exit
?
# Prevent the node from processing events unless it's a secondary
unless
Geo
.
secondary?
sleep
(
SECONDARY_CHECK_INTERVAL
)
sleep
_break
(
SECONDARY_CHECK_INTERVAL
)
next
end
...
...
@@ -45,6 +45,14 @@ module Gitlab
private
def
sleep_break
(
seconds
)
while
seconds
>
0
sleep
(
1
)
seconds
-=
1
break
if
exit
?
end
end
def
handle_events
(
batch
,
previous_batch_last_id
)
logger
.
info
(
"Handling events"
,
first_id:
batch
.
first
.
id
,
last_id:
batch
.
last
.
id
)
...
...
ee/spec/lib/gitlab/geo/log_cursor/daemon_spec.rb
View file @
c57622a2
...
...
@@ -54,7 +54,7 @@ describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state do
stub_current_geo_node
(
nil
)
is_expected
.
to
receive
(
:exit?
).
and_return
(
false
,
true
)
is_expected
.
to
receive
(
:sleep
).
with
(
1
.
minute
)
is_expected
.
to
receive
(
:sleep
_break
).
with
(
1
.
minute
)
is_expected
.
not_to
receive
(
:run_once!
)
daemon
.
run!
...
...
@@ -64,7 +64,7 @@ describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state do
stub_current_geo_node
(
primary
)
is_expected
.
to
receive
(
:exit?
).
and_return
(
false
,
true
)
is_expected
.
to
receive
(
:sleep
).
with
(
1
.
minute
)
is_expected
.
to
receive
(
:sleep
_break
).
with
(
1
.
minute
)
is_expected
.
not_to
receive
(
:run_once!
)
daemon
.
run!
...
...
@@ -163,7 +163,7 @@ describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state do
expect
(
Gitlab
::
Geo
::
Logger
).
to
receive
(
:warn
)
.
with
(
hash_including
(
class:
'Gitlab::Geo::LogCursor::Daemon'
,
message:
'
U
nknown event'
,
message:
'
#handle_single_event: u
nknown event'
,
event_log_id:
new_event
.
id
))
daemon
.
run_once!
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment