From 8eba275a6a7054ab7db42955bb57b5299fbdf21a Mon Sep 17 00:00:00 2001 From: Adam Ruzicka Date: Thu, 19 Oct 2023 10:00:18 +0200 Subject: [PATCH] Access sidekiq config using a non-deprecated way to avoid deprecation warnings like WARN: `config.options[:key] = value` is deprecated, use `config[:key] = value` --- lib/dynflow/executors/sidekiq/core.rb | 2 +- lib/dynflow/rails/configuration.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dynflow/executors/sidekiq/core.rb b/lib/dynflow/executors/sidekiq/core.rb index bc11f424..9d730c17 100644 --- a/lib/dynflow/executors/sidekiq/core.rb +++ b/lib/dynflow/executors/sidekiq/core.rb @@ -9,7 +9,7 @@ Sidekiq.configure_server do |config| # Use semi-reliable fetch # for details see https://gitlab.com/gitlab-org/sidekiq-reliable-fetch/blob/master/README.md - config.options[:semi_reliable_fetch] = true + config[:semi_reliable_fetch] = true Sidekiq::ReliableFetch.setup_reliable_fetch!(config) end diff --git a/lib/dynflow/rails/configuration.rb b/lib/dynflow/rails/configuration.rb index 8f9e1da6..46005d5d 100644 --- a/lib/dynflow/rails/configuration.rb +++ b/lib/dynflow/rails/configuration.rb @@ -100,7 +100,7 @@ def increase_db_pool_size? end def sidekiq_worker? - defined?(::Sidekiq) && ::Sidekiq.options[:queues].any? + defined?(::Sidekiq) && ::Sidekiq.configure_server { |c| c[:queues].any? } end def calculate_db_pool_size(world) @@ -108,7 +108,7 @@ def calculate_db_pool_size(world) base_value = 5 if defined?(::Sidekiq) - Sidekiq.options[:concurrency] + base_value + Sidekiq.configure_server { |c| c[:concurrency] } + base_value else world.config.queues.values.inject(base_value) do |pool_size, pool_options| pool_size += pool_options[:pool_size] @@ -152,7 +152,7 @@ def world_config # we can't do any operation until the Rails.application.dynflow.world is set config.auto_execute = false config.auto_validity_check = false - if sidekiq_worker? && !Sidekiq.options[:queues].include?("dynflow_orchestrator") + if sidekiq_worker? && !Sidekiq.configure_server { |c| c[:queues].include?("dynflow_orchestrator") } config.delayed_executor = nil end end @@ -192,7 +192,7 @@ def initialize_executor(world) if remote? false else - if defined?(::Sidekiq) && Sidekiq.options[:dynflow_executor] + if defined?(::Sidekiq) && Sidekiq.configure_server { |c| c[:dynflow_executor] } ::Dynflow::Executors::Sidekiq::Core else ::Dynflow::Executors::Parallel::Core