lib/ci/queue/redis/base.rb in ci-queue-0.40.0 vs lib/ci/queue/redis/base.rb in ci-queue-0.41.0
- old
+ new
@@ -11,15 +11,19 @@
::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,
- # 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],
- )
+ if ::Redis::VERSION > "5.0.0"
+ @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],
+ )
+ else
+ @redis = ::Redis.new(url: redis_url)
+ end
@config = config
end
def exhausted?
queue_initialized? && size == 0