ci-queue 0.24.0 → 0.24.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f51b9eaf62e347a724e6e1fc533c26d504cca7922a4296b750ae2599c7cfa6e
4
- data.tar.gz: 0b9833d46d95e90d67663a2ff5bea2a8ad17c781b812a9f8b4ec7485bf0789d0
3
+ metadata.gz: 2dddff029008b5dbe7ff19995f824f6c1d54a19e699377742a6e4599642f4b55
4
+ data.tar.gz: 9ff1268a7be473c4f35cb907193b24e04ae22189df0c116be9cc09db50112925
5
5
  SHA512:
6
- metadata.gz: b627008782774ad37ae5dbd5a2db0ae24df1f3fcda1dae9e0c0064f7c8df7890b926734855fd0f35d440e5e03d25441b6b9dc60c48bcaa19b8c5537c5d33c98b
7
- data.tar.gz: e3d1c41abfe02341deb545fda1e6eebb94826801ca104788d2aa48fab1886e6093acd402ef097f58c6b2bc4f403568386e45d1b8032f1323d4f7cfbf6f7f381b
6
+ metadata.gz: 755d03be6402d76d3d225c5c4dae6dafdf60f604fb6377c48403f98898b6ee6bc44634ad8d5dfdafe15f9ca2e3b8e304244850984f75aed67ae872064e9caedf
7
+ data.tar.gz: 157c12e846214542d78116fa168e380eba0b9266bcd2f3194d28c55951cc9c11cbc015582654ad6dfe09fac852e1123f3b9bbd8cd5b936ecdbf4075ce6a06784
@@ -22,7 +22,7 @@ module CI
22
22
  end
23
23
 
24
24
  def expired?
25
- if (created_at = redis.get(key('master-created-at')))
25
+ if (created_at = redis.get(key('created-at')))
26
26
  (created_at.to_f + config.redis_ttl + TEN_MINUTES) < Time.now.to_f
27
27
  else
28
28
  # if there is no created at set anymore we assume queue is expired
@@ -30,6 +30,10 @@ module CI
30
30
  end
31
31
  end
32
32
 
33
+ def created_at=(timestamp)
34
+ redis.setnx(key('created-at'), timestamp)
35
+ end
36
+
33
37
  def size
34
38
  redis.multi do |transaction|
35
39
  transaction.llen(key('queue'))
@@ -71,6 +75,10 @@ module CI
71
75
  end
72
76
  end
73
77
 
78
+ def queue_initializing?
79
+ master_status == 'setup'
80
+ end
81
+
74
82
  def increment_test_failed
75
83
  redis.incr(key('test_failed_count'))
76
84
  end
@@ -202,12 +202,10 @@ module CI
202
202
  transaction.lpush(key('queue'), tests) unless tests.empty?
203
203
  transaction.set(key('total'), @total)
204
204
  transaction.set(key('master-status'), 'ready')
205
- transaction.set(key('master-created-at'), Time.now.to_f)
206
205
 
207
206
  transaction.expire(key('queue'), config.redis_ttl)
208
207
  transaction.expire(key('total'), config.redis_ttl)
209
208
  transaction.expire(key('master-status'), config.redis_ttl)
210
- transaction.expire(key('master-created-at'), config.redis_ttl)
211
209
  end
212
210
  end
213
211
  register
@@ -11,6 +11,8 @@ module CI
11
11
  end
12
12
  end
13
13
 
14
+ TEN_MINUTES = 60 * 10
15
+
14
16
  attr_reader :progress, :total
15
17
 
16
18
  def initialize(tests, config)
@@ -37,6 +39,14 @@ module CI
37
39
  self
38
40
  end
39
41
 
42
+ def created_at=(timestamp)
43
+ @created_at ||= timestamp
44
+ end
45
+
46
+ def expired?
47
+ (@created_at.to_f TEN_MINUTES) < Time.now.to_f
48
+ end
49
+
40
50
  def populated?
41
51
  !!defined?(@index)
42
52
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CI
4
4
  module Queue
5
- VERSION = '0.24.0'
5
+ VERSION = '0.24.1'
6
6
  DEV_SCRIPTS_ROOT = ::File.expand_path('../../../../../redis', __FILE__)
7
7
  RELEASE_SCRIPTS_ROOT = ::File.expand_path('../redis', __FILE__)
8
8
  end
@@ -61,6 +61,8 @@ module Minitest
61
61
  end
62
62
  end
63
63
 
64
+ queue.rescue_connection_errors { queue.created_at = Time.now.to_f }
65
+
64
66
  set_load_path
65
67
  Minitest.queue = queue
66
68
  reporters = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci-queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.24.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-20 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler