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
6fde063f
Commit
6fde063f
authored
Apr 07, 2021
by
Quang-Minh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Set object instead of {}.compare_by_identity
parent
33d1ae4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
ee/lib/gitlab/database/load_balancing/host_list.rb
ee/lib/gitlab/database/load_balancing/host_list.rb
+3
-5
No files found.
ee/lib/gitlab/database/load_balancing/host_list.rb
View file @
6fde063f
...
...
@@ -8,7 +8,7 @@ module Gitlab
# hosts - The list of secondary hosts to add.
def
initialize
(
hosts
=
[])
@hosts
=
hosts
.
shuffle
@pools
=
{}.
compare_by_identity
@pools
=
Set
.
new
@index
=
0
@mutex
=
Mutex
.
new
@hosts_gauge
=
Gitlab
::
Metrics
.
gauge
(
:db_load_balancing_hosts
,
'Current number of load balancing hosts'
)
...
...
@@ -30,7 +30,7 @@ module Gitlab
end
def
manage_pool?
(
pool
)
@pools
[
pool
]
==
true
@pools
.
include?
(
pool
)
end
def
hosts
=
(
hosts
)
...
...
@@ -80,9 +80,7 @@ module Gitlab
end
def
update_pools
@pools
=
@hosts
.
each_with_object
({}.
compare_by_identity
)
do
|
host
,
flags
|
flags
[
host
.
pool
]
=
true
end
@pools
=
Set
.
new
(
@hosts
.
map
(
&
:pool
))
end
end
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