Skip to content

Commit

Permalink
Fixes #31964 - Assign equal weight to sidekiq queues
Browse files Browse the repository at this point in the history
The previous approach worker, but it made sidekiq default worker process all
items from the default queue before moving to remote execution queue. This
change adds equal weight to the queues, making sidekiq pick jobs from both.
  • Loading branch information
ekohl committed Apr 6, 2021
1 parent a3e9650 commit 4567278
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion manifests/dynflow/pool.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
String $service_name = $name,
Integer[0] $instances = $foreman::dynflow_worker_instances,
Integer[1] $concurrency = $foreman::dynflow_worker_concurrency,
Array[String[1], 1] $queues = [],
Array[Variant[String[1], Tuple[String, Integer[0]]], 1] $queues = [],
Optional[String[1]] $config_owner = undef,
Optional[String[1]] $config_group = undef,
) {
Expand Down
4 changes: 2 additions & 2 deletions manifests/dynflow/worker.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
Enum['present', 'absent'] $ensure = 'present',
String $service_name = $name,
Integer[1] $concurrency = 1,
Array[String[1]] $queues = [],
Array[Variant[String[1], Tuple[String, Integer[0]]]] $queues = [],
String[1] $config_owner = 'root',
Optional[String[1]] $config_group = undef,
Stdlib::Filemode $config_mode = '0644',
Expand All @@ -32,7 +32,7 @@
$service = "dynflow-sidekiq@${service_name}"

if $ensure == 'present' {
assert_type(Array[String[1], 1], $queues)
assert_type(Array[Variant[String[1], Tuple[String, Integer[0]]], 1], $queues)

$config = {
'concurrency' => $concurrency,
Expand Down
2 changes: 1 addition & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

foreman::dynflow::pool { 'worker':
queues => ['default', 'remote_execution'],
queues => [['default', 1], ['remote_execution', 1]],
instances => $dynflow_worker_instances,
concurrency => $dynflow_worker_concurrency,
}
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/foreman_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
should contain_foreman__dynflow__worker('worker-1')
.with_ensure('present')
.with_concurrency(5)
.with_queues(['default', 'remote_execution'])
.with_queues([['default', 1], ['remote_execution', 1]])
end

# service
Expand Down

0 comments on commit 4567278

Please sign in to comment.