ci-queue 0.2.0 → 0.3.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/worker.rb +20 -2
- data/lib/ci/queue/version.rb +1 -1
- data/lib/minitest/queue.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e705f791872606bc69ef5bf0851b3d70d3a7306f
|
4
|
+
data.tar.gz: 6132821be168baecd4e6bc963830f6594cf74d6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5564b0a1b1e8d0c9c3f8e26a3403a926a0f406e06c8770aa5fefdd9223926d7d76faa200977d818068c23c266ab819491ca3e5b7253500a2a049e5b9af9393fb
|
7
|
+
data.tar.gz: df04b3f6bc3f975ca00253c9eb06c6c77944dc0cf689a0ec3f995a142ba6e88a95fbd5b57227f4e202cc5b4ec6f57527115ee32592b23c568406a102494d4dd1
|
@@ -5,6 +5,11 @@ module CI
|
|
5
5
|
module Redis
|
6
6
|
ReservationError = Class.new(StandardError)
|
7
7
|
|
8
|
+
class << self
|
9
|
+
attr_accessor :requeue_offset
|
10
|
+
end
|
11
|
+
self.requeue_offset = 42
|
12
|
+
|
8
13
|
class Worker < Base
|
9
14
|
attr_reader :total
|
10
15
|
|
@@ -100,11 +105,24 @@ module CI
|
|
100
105
|
true
|
101
106
|
end
|
102
107
|
|
103
|
-
|
108
|
+
REQUEUE = %{
|
109
|
+
local queue_key = KEYS[1]
|
110
|
+
local test = ARGV[1]
|
111
|
+
local offset = ARGV[2]
|
112
|
+
|
113
|
+
local pivot = redis.call('lrange', queue_key, -1 - offset, 0 - offset)[1]
|
114
|
+
if pivot then
|
115
|
+
redis.call('linsert', queue_key, 'BEFORE', pivot, test)
|
116
|
+
else
|
117
|
+
redis.call('lpush', queue_key, test)
|
118
|
+
end
|
119
|
+
}
|
120
|
+
def requeue(test, offset: Redis.requeue_offset)
|
104
121
|
load_script(ACKNOWLEDGE)
|
122
|
+
load_script(REQUEUE)
|
105
123
|
redis.multi do
|
106
124
|
redis.decr(key('processed'))
|
107
|
-
|
125
|
+
eval_script(REQUEUE, keys: [key('queue')], argv: [test, offset])
|
108
126
|
ack(test)
|
109
127
|
end
|
110
128
|
end
|
data/lib/ci/queue/version.rb
CHANGED
data/lib/minitest/queue.rb
CHANGED
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.3.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: 2016-11-
|
11
|
+
date: 2016-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|