Skip to content

Commit 0463f1e

Browse files
committed
Set expire on set
1 parent 4aaf178 commit 0463f1e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ruby/lib/ci/queue/redis/base.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ class Base
88
TEN_MINUTES = 60 * 10
99
CONNECTION_ERRORS = [
1010
::Redis::BaseConnectionError,
11-
RedisClient::ConnectionError,
1211
::SocketError, # https://github.com/redis/redis-rb/pull/631
13-
].freeze
12+
]
13+
14+
# https://github.com/redis/redis-rb/pull/1312
15+
CONNECTION_ERRORS << RedisClient::ConnectionError if defined?(RedisClient::ConnectionError)
1416

1517
module RedisInstrumentation
1618
def call(command, redis_config)

ruby/lib/ci/queue/redis/worker.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,10 @@ def push(tests)
212212
begin
213213
redis.multi do |transaction|
214214
transaction.lpush(key('queue'), tests) unless tests.empty?
215-
transaction.set(key('total'), @total)
216-
transaction.set(key('master-status'), 'ready')
215+
transaction.set(key('total'), @total, ex: config.redis_ttl)
216+
transaction.set(key('master-status'), 'ready', ex: config.redis_ttl)
217217

218218
transaction.expire(key('queue'), config.redis_ttl)
219-
transaction.expire(key('total'), config.redis_ttl)
220-
transaction.expire(key('master-status'), config.redis_ttl)
221219
end
222220
rescue ::Redis::BaseError, RedisClient::Error => error
223221
if !queue_initialized? && attempts < 3

0 commit comments

Comments
 (0)