From 456727818409fe85cab34a8e142661842135703c Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 25 Mar 2021 17:13:50 +0100 Subject: [PATCH] Fixes #31964 - Assign equal weight to sidekiq queues 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. --- manifests/dynflow/pool.pp | 2 +- manifests/dynflow/worker.pp | 4 ++-- manifests/service.pp | 2 +- spec/classes/foreman_spec.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/dynflow/pool.pp b/manifests/dynflow/pool.pp index 670d3a6d7..a5ad713da 100644 --- a/manifests/dynflow/pool.pp +++ b/manifests/dynflow/pool.pp @@ -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, ) { diff --git a/manifests/dynflow/worker.pp b/manifests/dynflow/worker.pp index a74b28c5d..ba9b2aa34 100644 --- a/manifests/dynflow/worker.pp +++ b/manifests/dynflow/worker.pp @@ -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', @@ -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, diff --git a/manifests/service.pp b/manifests/service.pp index c7b4aea7d..c2fd23996 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -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, } diff --git a/spec/classes/foreman_spec.rb b/spec/classes/foreman_spec.rb index d9d1ba812..2e5a28822 100644 --- a/spec/classes/foreman_spec.rb +++ b/spec/classes/foreman_spec.rb @@ -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