ci-queue 0.44.0 → 0.46.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ci/queue/redis/base.rb +8 -0
- data/lib/ci/queue/static.rb +12 -3
- data/lib/ci/queue/version.rb +1 -1
- data/lib/minitest/queue/runner.rb +17 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea479767ef84b35f96de1e28bd5e4a79027bb90e7a6d06c101056f6486a63e8b
|
4
|
+
data.tar.gz: c932bac995769751c422790553a063685f4690aa5f7ceffb07ce04174e88bfe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf13fd4ee60aeff7024e2af393986b19315b0b006a233b00c6468758ada80242344c405b0954bd0ecd3b17f9511048b3fe49049ac342d2b9f3743963348c84f9
|
7
|
+
data.tar.gz: f0e9933fd3ccff6fb536717cd249cad212d53deaa4c72681fe36ea54247f015c8c9b960870f8b9fd3a1f318e103ae67aeb380c8151c1a3ea121ed7ec49a96b47
|
data/lib/ci/queue/redis/base.rb
CHANGED
@@ -118,6 +118,14 @@ module CI
|
|
118
118
|
end.inject(:+)
|
119
119
|
end
|
120
120
|
|
121
|
+
def remaining
|
122
|
+
redis.llen(key('queue'))
|
123
|
+
end
|
124
|
+
|
125
|
+
def running
|
126
|
+
redis.zcard(key('running'))
|
127
|
+
end
|
128
|
+
|
121
129
|
def to_a
|
122
130
|
redis.multi do |transaction|
|
123
131
|
transaction.lrange(key('queue'), 0, -1)
|
data/lib/ci/queue/static.rb
CHANGED
@@ -63,7 +63,7 @@ module CI
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def expired?
|
66
|
-
(@created_at.to_f TEN_MINUTES) < CI::Queue.time_now.to_f
|
66
|
+
(@created_at.to_f + TEN_MINUTES) < CI::Queue.time_now.to_f
|
67
67
|
end
|
68
68
|
|
69
69
|
def populated?
|
@@ -78,10 +78,19 @@ module CI
|
|
78
78
|
@queue.size
|
79
79
|
end
|
80
80
|
|
81
|
+
def remaining
|
82
|
+
@queue.size
|
83
|
+
end
|
84
|
+
|
85
|
+
def running
|
86
|
+
@reserved_test ? 1 : 0
|
87
|
+
end
|
88
|
+
|
81
89
|
def poll
|
82
|
-
while !@shutdown && config.circuit_breakers.none?(&:open?) && !max_test_failed? &&
|
83
|
-
yield index.fetch(
|
90
|
+
while !@shutdown && config.circuit_breakers.none?(&:open?) && !max_test_failed? && @reserved_test = @queue.shift
|
91
|
+
yield index.fetch(@reserved_test)
|
84
92
|
end
|
93
|
+
@reserved_test = nil
|
85
94
|
end
|
86
95
|
|
87
96
|
def exhausted?
|
data/lib/ci/queue/version.rb
CHANGED
@@ -86,8 +86,23 @@ module Minitest
|
|
86
86
|
if queue.rescue_connection_errors { queue.exhausted? }
|
87
87
|
puts green('All tests were ran already')
|
88
88
|
else
|
89
|
-
|
90
|
-
|
89
|
+
# If the job gets (automatically) retried and there are still workers running but not many tests left
|
90
|
+
# in the queue, we assume by the time the application is booted the queue is empty and it's faster to no-op.
|
91
|
+
if retry?
|
92
|
+
remaining = queue.rescue_connection_errors { queue.remaining }.to_i
|
93
|
+
running = queue.rescue_connection_errors { queue.running }.to_i
|
94
|
+
|
95
|
+
puts "#{remaining} tests left and #{running} workers running."
|
96
|
+
if remaining <= running
|
97
|
+
puts green("Queue almost empty, exiting early...")
|
98
|
+
else
|
99
|
+
load_tests
|
100
|
+
populate_queue
|
101
|
+
end
|
102
|
+
else
|
103
|
+
load_tests
|
104
|
+
populate_queue
|
105
|
+
end
|
91
106
|
end
|
92
107
|
|
93
108
|
at_exit {
|
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.
|
4
|
+
version: 0.46.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|