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
28d49bcb
Commit
28d49bcb
authored
Apr 27, 2021
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sticks to the primary if no location provided
- Fix specs for sidekiq server middleware
parent
79eff458
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
ee/lib/gitlab/database/load_balancing/sidekiq_server_middleware.rb
...tlab/database/load_balancing/sidekiq_server_middleware.rb
+2
-2
ee/spec/lib/gitlab/database/load_balancing/sidekiq_server_middleware_spec.rb
...database/load_balancing/sidekiq_server_middleware_spec.rb
+2
-2
No files found.
ee/lib/gitlab/database/load_balancing/sidekiq_server_middleware.rb
View file @
28d49bcb
...
...
@@ -30,6 +30,8 @@ module Gitlab
location
=
job
[
'database_write_location'
]
||
job
[
'database_replica_location'
]
return
true
unless
location
if
replica_caught_up?
(
location
)
job
[
:database_chosen
]
=
'replica'
false
...
...
@@ -48,8 +50,6 @@ module Gitlab
end
def
replica_caught_up?
(
location
)
return
true
unless
location
load_balancer
.
host
.
caught_up?
(
location
)
end
end
...
...
ee/spec/lib/gitlab/database/load_balancing/sidekiq_server_middleware_spec.rb
View file @
28d49bcb
...
...
@@ -93,14 +93,14 @@ RSpec.describe Gitlab::Database::LoadBalancing::SidekiqServerMiddleware do
context
'when database location is not set'
do
let
(
:job
)
{
{
'job_id'
=>
'a180b47c-3fd6-41b8-81e9-34da61c3400e'
}
}
it_behaves_like
'
replica is up to date
'
,
nil
it_behaves_like
'
stick to the primary
'
,
nil
end
end
let
(
:queue
)
{
'default'
}
let
(
:redis_pool
)
{
Sidekiq
.
redis_pool
}
let
(
:worker
)
{
worker_class
.
new
}
let
(
:job
)
{
{
"job_id"
=>
"a180b47c-3fd6-41b8-81e9-34da61c3400e"
}
}
let
(
:job
)
{
{
"job_id"
=>
"a180b47c-3fd6-41b8-81e9-34da61c3400e"
,
'database_replica_location'
=>
'0/D525E3A8'
}
}
let
(
:block
)
{
10
}
before
do
...
...
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