lib/ci/queue/redis/base.rb in ci-queue-0.38.0 vs lib/ci/queue/redis/base.rb in ci-queue-0.39.0
- old
+ new
@@ -11,10 +11,15 @@
::SocketError, # https://github.com/redis/redis-rb/pull/631
].freeze
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
def exhausted?
queue_initialized? && size == 0