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
c5256c8e
Commit
c5256c8e
authored
Nov 20, 2021
by
Linjie Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Override sidekig_config method in JH repo
parent
836a2bb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
19 deletions
+13
-19
lib/gitlab/sidekiq_config.rb
lib/gitlab/sidekiq_config.rb
+12
-17
lib/tasks/gitlab/sidekiq.rake
lib/tasks/gitlab/sidekiq.rake
+1
-2
No files found.
lib/gitlab/sidekiq_config.rb
View file @
c5256c8e
...
...
@@ -49,14 +49,7 @@ module Gitlab
def
config_queues
@config_queues
||=
begin
config
=
YAML
.
load_file
(
Rails
.
root
.
join
(
SIDEKIQ_QUEUES_PATH
))
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
config
[
:queues
].
map
(
&
:first
)
end
end
...
...
@@ -105,32 +98,32 @@ 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
(
jh:
false
)
def
queues_for_sidekiq_queues_yml
namespaces_with_equal_weights
=
workers
.
select
{
|
worker
|
worker
.
jh?
==
jh
}
.
reject
{
|
worker
|
worker
.
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
.
select
{
|
worker
|
worker
.
jh?
==
jh
}.
reject
{
|
worker
|
namespaces
.
include?
(
worker
.
queue_namespace
)
}
remaining_queues
=
workers
.
reject
{
|
worker
|
worker
.
jh?
}.
reject
{
|
worker
|
namespaces
.
include?
(
worker
.
queue_namespace
)
}
(
namespaces_with_equal_weights
.
map
(
&
:namespace_and_weight
)
+
remaining_queues
.
map
(
&
:queue_and_weight
)).
sort
end
# Override in JH repo
def
jh_queues_for_sidekiq_queues_yml
[]
end
# YAML.load_file is OK here as we control the file contents
def
sidekiq_queues_yml_outdated?
config_queues
=
YAML
.
load_file
(
SIDEKIQ_QUEUES_PATH
)[
: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
queues_for_sidekiq_queues_yml
!=
config_queues
end
# Returns a hash of worker class name => mapped queue name
...
...
@@ -168,3 +161,5 @@ module Gitlab
end
end
end
Gitlab
::
SidekiqConfig
.
prepend_mod
lib/tasks/gitlab/sidekiq.rake
View file @
c5256c8e
...
...
@@ -102,8 +102,7 @@ namespace :gitlab do
write_yaml
(
Gitlab
::
SidekiqConfig
::
SIDEKIQ_QUEUES_PATH
,
banner
,
queues:
queues_and_weights
)
if
Gitlab
.
jh?
jh_queues_and_weights
=
Gitlab
::
SidekiqConfig
.
queues_for_sidekiq_queues_yml
(
jh:
true
)
write_yaml
(
Gitlab
::
SidekiqConfig
::
JH_SIDEKIQ_QUEUES_PATH
,
banner
,
queues:
jh_queues_and_weights
)
write_yaml
(
Gitlab
::
SidekiqConfig
::
JH_SIDEKIQ_QUEUES_PATH
,
banner
,
queues:
Gitlab
::
SidekiqConfig
.
jh_queues_for_sidekiq_queues_yml
)
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