diff --git a/ruby/lib/ci/queue/redis.rb b/ruby/lib/ci/queue/redis.rb index 526c4aed..89031b54 100644 --- a/ruby/lib/ci/queue/redis.rb +++ b/ruby/lib/ci/queue/redis.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +gem 'redis', '>= 5' require 'redis' require 'ci/queue/redis/build_record' require 'ci/queue/redis/base' diff --git a/ruby/lib/ci/queue/redis/base.rb b/ruby/lib/ci/queue/redis/base.rb index f8bba79e..dd8211f2 100644 --- a/ruby/lib/ci/queue/redis/base.rb +++ b/ruby/lib/ci/queue/redis/base.rb @@ -13,7 +13,12 @@ class Base def initialize(redis_url, config) @redis_url = redis_url - @redis = ::Redis.new(url: redis_url) + @redis = ::Redis.new( + 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], + ) @config = config end