diff --git a/ruby/lib/ci/queue/redis/base.rb b/ruby/lib/ci/queue/redis/base.rb index 7453ac50..6164f94d 100644 --- a/ruby/lib/ci/queue/redis/base.rb +++ b/ruby/lib/ci/queue/redis/base.rb @@ -35,7 +35,7 @@ def initialize(redis_url, config) url: redis_url, # Booting a CI worker is costly, so in case of a Redis blip, # it makes sense to retry for a while before giving up. - reconnect_attempts: [0, 0, 0.1, 0.5, 1, 3, 5], + reconnect_attempts: reconnect_attempts, middlewares: custom_middlewares, custom: custom_config, ) @@ -44,6 +44,12 @@ def initialize(redis_url, config) end end + def reconnect_attempts + return [] if ENV["CI_QUEUE_DISABLE_RECONNECT_ATTEMPTS"] + + [0, 0, 0.1, 0.5, 1, 3, 5] + end + def custom_config return unless config.debug_log diff --git a/ruby/test/integration/minitest_redis_test.rb b/ruby/test/integration/minitest_redis_test.rb index 0bd9f8d7..207e3098 100644 --- a/ruby/test/integration/minitest_redis_test.rb +++ b/ruby/test/integration/minitest_redis_test.rb @@ -437,6 +437,7 @@ def test_retry_report def test_down_redis out, err = capture_subprocess_io do system( + { "CI_QUEUE_DISABLE_RECONNECT_ATTEMPTS" => "1" }, @exe, 'run', '--queue', 'redis://localhost:1337', '--seed', 'foobar',