ci-queue 0.65.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bd235c5c9a18d43b30d5fc614e960e297b60fbaa3391a47db9eaa07cfa1bb4f
4
- data.tar.gz: 9f61f75c48456aaac0abb2b25e3cb200a22f00baf5c5612828bd61b54a59ed46
3
+ metadata.gz: b78efa3839e0fdc3a3998ef7d664bab01f28d0cdde96c28b790f9c912964d33a
4
+ data.tar.gz: 4bc014eb8401ce329be509dc76f449a4d80696667563e3236c5f9634514b7df0
5
5
  SHA512:
6
- metadata.gz: 640842ac7e07b54184cab3a9881ec5f0401f3c128b6d8bf0011d576650e94c4f85864664fcc51b3fac6d6028b4fd95a7943364aa397e060acc3ddc56647662f6
7
- data.tar.gz: 4d8aa80210424460498cb29bee6fb7d18db2f1a9c453550c98e4133f34862d7a9882df5c60bf0b0f88e245210af7b6be943cf811c20d3e0f5a53d5ab2bf8e8dd
6
+ metadata.gz: be5f84376a0a6bc93776eaafa4a725e48061e18ea13d79c407cb599b665201031fc189ae91cd89607f3c2fa062eb388caaa554411405cc7adf6b073610ee078f
7
+ data.tar.gz: 47057ca6d1b2d35eb0068be06330802a0ce614744f8498d069ef9bc1ffdd499a8a38861a3bfa7aa62e2b10becd0be5c99306026938c7ca704ede42396109367c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci-queue (0.65.0)
4
+ ci-queue (0.66.0)
5
5
  logger
6
6
 
7
7
  GEM
@@ -11,6 +11,8 @@ module CI
11
11
  ::SocketError, # https://github.com/redis/redis-rb/pull/631
12
12
  ].freeze
13
13
 
14
+ DEFAULT_TIMEOUT = 2
15
+
14
16
  module RedisInstrumentation
15
17
  def call(command, redis_config)
16
18
  logger = redis_config.custom[:debug_log]
@@ -45,9 +47,10 @@ module CI
45
47
  # ci-queue should not contain any sensitive data, so we can just disable the verification.
46
48
  ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE },
47
49
  custom: custom_config,
50
+ timeout: DEFAULT_TIMEOUT,
48
51
  )
49
52
  else
50
- @redis = ::Redis.new(url: redis_url)
53
+ @redis = ::Redis.new(url: redis_url, timeout: DEFAULT_TIMEOUT)
51
54
  end
52
55
  end
53
56
 
@@ -201,7 +201,14 @@ module CI
201
201
  def push(tests)
202
202
  @total = tests.size
203
203
 
204
- if @master = redis.setnx(key('master-status'), 'setup')
204
+ # We set a unique value (worker_id) and read it back to make "SET if Not eXists" idempotent in case of a retry.
205
+ value = key('setup', worker_id)
206
+ _, status = redis.pipelined do |pipeline|
207
+ pipeline.set(key('master-status'), value, nx: true)
208
+ pipeline.get(key('master-status'))
209
+ end
210
+
211
+ if @master = (value == status)
205
212
  puts "Worker electected as leader, pushing #{@total} tests to the queue."
206
213
  puts
207
214
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CI
4
4
  module Queue
5
- VERSION = '0.65.0'
5
+ VERSION = '0.66.0'
6
6
  DEV_SCRIPTS_ROOT = ::File.expand_path('../../../../../redis', __FILE__)
7
7
  RELEASE_SCRIPTS_ROOT = ::File.expand_path('../redis', __FILE__)
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci-queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.65.0
4
+ version: 0.66.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier