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
8c034072
Commit
8c034072
authored
Nov 17, 2021
by
Linjie Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add JH config for sidekiq_queues
parent
99c7c140
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
lib/gitlab/sidekiq_config.rb
lib/gitlab/sidekiq_config.rb
+18
-4
lib/tasks/gitlab/sidekiq.rake
lib/tasks/gitlab/sidekiq.rake
+6
-0
No files found.
lib/gitlab/sidekiq_config.rb
View file @
8c034072
...
...
@@ -8,6 +8,7 @@ module Gitlab
EE_QUEUE_CONFIG_PATH
=
'ee/app/workers/all_queues.yml'
JH_QUEUE_CONFIG_PATH
=
'jh/app/workers/all_queues.yml'
SIDEKIQ_QUEUES_PATH
=
'config/sidekiq_queues.yml'
JH_SIDEKIQ_QUEUES_PATH
=
'jh/config/sidekiq_queues.yml'
QUEUE_CONFIG_PATHS
=
[
FOSS_QUEUE_CONFIG_PATH
,
...
...
@@ -48,7 +49,14 @@ module Gitlab
def
config_queues
@config_queues
||=
begin
config
=
YAML
.
load_file
(
Rails
.
root
.
join
(
SIDEKIQ_QUEUES_PATH
))
config
[
:queues
].
map
(
&
:first
)
queues
=
config
[
:queues
].
map
(
&
:first
)
if
Gitlab
.
jh?
&&
File
.
exist?
(
JH_SIDEKIQ_QUEUES_PATH
)
jh_config
=
YAML
.
load_file
(
JH_SIDEKIQ_QUEUES_PATH
)
queues
+=
jh_config
[
:queues
].
map
(
&
:first
)
end
queues
end
end
...
...
@@ -97,16 +105,17 @@ module Gitlab
Gitlab
.
jh?
&&
File
.
exist?
(
JH_QUEUE_CONFIG_PATH
)
&&
jh_workers
!=
YAML
.
load_file
(
JH_QUEUE_CONFIG_PATH
)
end
def
queues_for_sidekiq_queues_yml
def
queues_for_sidekiq_queues_yml
(
jh:
false
)
namespaces_with_equal_weights
=
workers
.
select
{
|
worker
|
worker
.
jh?
==
jh
}
.
group_by
(
&
:queue_namespace
)
.
map
(
&
:last
)
.
select
{
|
workers
|
workers
.
map
(
&
:get_weight
).
uniq
.
count
==
1
}
.
map
(
&
:first
)
namespaces
=
namespaces_with_equal_weights
.
map
(
&
:queue_namespace
).
to_set
remaining_queues
=
workers
.
reject
{
|
worker
|
namespaces
.
include?
(
worker
.
queue_namespace
)
}
remaining_queues
=
workers
.
select
{
|
worker
|
worker
.
jh?
==
jh
}.
reject
{
|
worker
|
namespaces
.
include?
(
worker
.
queue_namespace
)
}
(
namespaces_with_equal_weights
.
map
(
&
:namespace_and_weight
)
+
remaining_queues
.
map
(
&
:queue_and_weight
)).
sort
...
...
@@ -116,7 +125,12 @@ module Gitlab
def
sidekiq_queues_yml_outdated?
config_queues
=
YAML
.
load_file
(
SIDEKIQ_QUEUES_PATH
)[
:queues
]
queues_for_sidekiq_queues_yml
!=
config_queues
if
Gitlab
.
jh?
&&
File
.
exist?
(
JH_SIDEKIQ_QUEUES_PATH
)
jh_config_queues
=
YAML
.
load_file
(
JH_SIDEKIQ_QUEUES_PATH
)[
:queues
]
queues_for_sidekiq_queues_yml
!=
config_queues
||
queues_for_sidekiq_queues_yml
(
jh:
true
)
!=
jh_config_queues
else
queues_for_sidekiq_queues_yml
!=
config_queues
end
end
# Returns a hash of worker class name => mapped queue name
...
...
lib/tasks/gitlab/sidekiq.rake
View file @
8c034072
...
...
@@ -100,6 +100,11 @@ namespace :gitlab do
queues_and_weights
=
Gitlab
::
SidekiqConfig
.
queues_for_sidekiq_queues_yml
write_yaml
(
Gitlab
::
SidekiqConfig
::
SIDEKIQ_QUEUES_PATH
,
banner
,
queues:
queues_and_weights
)
if
Gitlab
.
jh?
jh_quesues_and_weights
=
Gitlab
::
SidekiqConfig
.
queues_for_sidekiq_queues_yml
(
jh:
true
)
write_yaml
(
Gitlab
::
SidekiqConfig
::
JH_SIDEKIQ_QUEUES_PATH
,
banner
,
queues:
jh_quesues_and_weights
)
end
end
desc
'GitLab | Sidekiq | Validate that sidekiq_queues.yml matches worker definitions'
...
...
@@ -113,6 +118,7 @@ namespace :gitlab do
Then commit and push the changes from:
-
#{
Gitlab
::
SidekiqConfig
::
SIDEKIQ_QUEUES_PATH
}
#{
"- "
+
Gitlab
::
SidekiqConfig
::
JH_SIDEKIQ_QUEUES_PATH
if
Gitlab
.
jh?
}
MSG
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