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
67ebba43
Commit
67ebba43
authored
Aug 02, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allows passing multiple queue sets to --negate argument
parent
834a73dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
lib/gitlab/sidekiq_cluster/cli.rb
lib/gitlab/sidekiq_cluster/cli.rb
+4
-3
spec/lib/gitlab/sidekiq_cluster/cli_spec.rb
spec/lib/gitlab/sidekiq_cluster/cli_spec.rb
+4
-6
No files found.
lib/gitlab/sidekiq_cluster/cli.rb
View file @
67ebba43
...
@@ -32,7 +32,8 @@ module Gitlab
...
@@ -32,7 +32,8 @@ module Gitlab
queues
=
queues
=
if
@negated_queues
&
.
any?
if
@negated_queues
&
.
any?
[
SidekiqConfig
.
queues
(
@rails_path
,
except:
@negated_queues
)]
parsed_queues
=
SidekiqCluster
.
parse_queues
(
@negated_queues
)
parsed_queues
.
map
{
|
queues
|
SidekiqConfig
.
queues
(
@rails_path
,
except:
queues
)
}
else
else
SidekiqCluster
.
parse_queues
(
argv
)
SidekiqCluster
.
parse_queues
(
argv
)
end
end
...
@@ -98,8 +99,8 @@ module Gitlab
...
@@ -98,8 +99,8 @@ module Gitlab
@rails_path
=
path
@rails_path
=
path
end
end
opt
.
on
(
'-n'
,
'--negate
[QUEUE,QUEUE]
'
,
"Run workers for all queues except these"
)
do
|
queues
|
opt
.
on
(
'-n'
,
'--negate
"[QUEUE,QUEUE] [QUEUE]"
'
,
"Run workers for all queues except these"
)
do
|
queues
|
@negated_queues
=
queues
.
split
(
','
)
@negated_queues
=
queues
.
split
end
end
opt
.
on
(
'-i'
,
'--interval INT'
,
'The number of seconds to wait between worker checks'
)
do
|
int
|
opt
.
on
(
'-i'
,
'--interval INT'
,
'The number of seconds to wait between worker checks'
)
do
|
int
|
...
...
spec/lib/gitlab/sidekiq_cluster/cli_spec.rb
View file @
67ebba43
...
@@ -12,7 +12,7 @@ describe Gitlab::SidekiqCluster::CLI do
...
@@ -12,7 +12,7 @@ describe Gitlab::SidekiqCluster::CLI do
context
'with arguments'
do
context
'with arguments'
do
it
'starts the Sidekiq workers'
do
it
'starts the Sidekiq workers'
do
expect
(
Gitlab
::
SidekiqCluster
).
to
receive
(
:start
).
with
([[
'foo'
]],
'test'
,
Dir
.
pwd
).
and_return
([])
expect
(
Gitlab
::
SidekiqCluster
).
to
receive
(
:start
).
and_return
([])
expect
(
cli
).
to
receive
(
:write_pid
)
expect
(
cli
).
to
receive
(
:write_pid
)
expect
(
cli
).
to
receive
(
:trap_signals
)
expect
(
cli
).
to
receive
(
:trap_signals
)
expect
(
cli
).
to
receive
(
:start_loop
)
expect
(
cli
).
to
receive
(
:start_loop
)
...
@@ -22,17 +22,15 @@ describe Gitlab::SidekiqCluster::CLI do
...
@@ -22,17 +22,15 @@ describe Gitlab::SidekiqCluster::CLI do
context
'with --negate argument'
do
context
'with --negate argument'
do
it
'starts Sidekiq workers for all queues except the negated ones'
do
it
'starts Sidekiq workers for all queues except the negated ones'
do
expect
(
Gitlab
::
SidekiqConfig
).
to
receive
(
:queues
)
expect
(
Gitlab
::
SidekiqConfig
).
to
receive
(
:queues
).
twice
.
and_return
([
'baz'
])
.
with
(
Dir
.
pwd
,
except:
[
'foo'
,
'bar'
])
.
and_return
([
'baz'
])
expect
(
Gitlab
::
SidekiqCluster
).
to
receive
(
:start
)
expect
(
Gitlab
::
SidekiqCluster
).
to
receive
(
:start
)
.
with
([[
'baz'
]],
'test'
,
Dir
.
pwd
)
.
with
([[
'baz'
]
,
[
'baz'
]
],
'test'
,
Dir
.
pwd
)
.
and_return
([])
.
and_return
([])
expect
(
cli
).
to
receive
(
:write_pid
)
expect
(
cli
).
to
receive
(
:write_pid
)
expect
(
cli
).
to
receive
(
:trap_signals
)
expect
(
cli
).
to
receive
(
:trap_signals
)
expect
(
cli
).
to
receive
(
:start_loop
)
expect
(
cli
).
to
receive
(
:start_loop
)
cli
.
run
(
%w(-n
foo,bar
)
)
cli
.
run
(
%w(-n
"foo,bar\ foo,bar"
)
)
end
end
end
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