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
b1226f6f
Commit
b1226f6f
authored
Apr 04, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert Geo::Scheduler::SchedulerWorker to use Gitlab::Geo::LogHelpers
parent
8ba33b5d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
ee/app/workers/geo/scheduler/scheduler_worker.rb
ee/app/workers/geo/scheduler/scheduler_worker.rb
+8
-12
ee/spec/workers/geo/scheduler/scheduler_worker_spec.rb
ee/spec/workers/geo/scheduler/scheduler_worker_spec.rb
+9
-0
No files found.
ee/app/workers/geo/scheduler/scheduler_worker.rb
View file @
b1226f6f
...
@@ -4,6 +4,7 @@ module Geo
...
@@ -4,6 +4,7 @@ module Geo
include
ApplicationWorker
include
ApplicationWorker
include
GeoQueue
include
GeoQueue
include
ExclusiveLeaseGuard
include
ExclusiveLeaseGuard
include
::
Gitlab
::
Geo
::
LogHelpers
include
::
Gitlab
::
Utils
::
StrongMemoize
include
::
Gitlab
::
Utils
::
StrongMemoize
DB_RETRIEVE_BATCH_SIZE
=
1000
DB_RETRIEVE_BATCH_SIZE
=
1000
...
@@ -68,7 +69,14 @@ module Geo
...
@@ -68,7 +69,14 @@ module Geo
private
private
# Subclasses should override this method to provide additional metadata
# in log messages
def
worker_metadata
def
worker_metadata
{}
end
def
base_log_data
(
message
)
super
(
message
).
merge
(
worker_metadata
)
end
end
def
db_retrieve_batch_size
def
db_retrieve_batch_size
...
@@ -185,18 +193,6 @@ module Geo
...
@@ -185,18 +193,6 @@ module Geo
Gitlab
::
Geo
.
current_node_enabled?
Gitlab
::
Geo
.
current_node_enabled?
end
end
end
end
def
log_info
(
message
,
extra_args
=
{})
args
=
{
class:
self
.
class
.
name
,
message:
message
}.
merge
(
extra_args
)
args
.
merge!
(
worker_metadata
)
if
worker_metadata
Gitlab
::
Geo
::
Logger
.
info
(
args
)
end
def
log_error
(
message
,
extra_args
=
{})
args
=
{
class:
self
.
class
.
name
,
message:
message
}.
merge
(
extra_args
)
args
.
merge!
(
worker_metadata
)
if
worker_metadata
Gitlab
::
Geo
::
Logger
.
error
(
args
)
end
end
end
end
end
end
end
ee/spec/workers/geo/scheduler/scheduler_worker_spec.rb
0 → 100644
View file @
b1226f6f
require
'spec_helper'
describe
Geo
::
Scheduler
::
SchedulerWorker
do
it
'includes ::Gitlab::Geo::LogHelpers'
do
expect
(
described_class
).
to
include_module
(
::
Gitlab
::
Geo
::
LogHelpers
)
end
it
'needs many other specs'
end
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