Skip to content

Commit

Permalink
Disable reconnect attempts in test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBr committed Jan 24, 2024
1 parent 8d3c83a commit d898628
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ruby/lib/ci/queue/redis/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions ruby/test/integration/minitest_redis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit d898628

Please sign in to comment.