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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61155b4429b71670e473e39cf41dbac081c24727
4
- data.tar.gz: 60d3c11057a5d7412554f51f10fe8beeefb4a483
3
+ metadata.gz: e705f791872606bc69ef5bf0851b3d70d3a7306f
4
+ data.tar.gz: 6132821be168baecd4e6bc963830f6594cf74d6e
5
5
  SHA512:
6
- metadata.gz: d59e89e8a27f00177f32ee55d7115b93617e21a9cfa2161a211da558831aeddadd4739242a93e9f12e183458839e6766903084b03814730848127a5febd9e21b
7
- data.tar.gz: 377c2123f5a51743a78abd13b5fd5c72f3bada7a1f230ea6712cef43275365e03a166f54c01097d111f2fd390b8f71d756732768fb70cc711d40c087867ee804
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
- def requeue(test)
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
- redis.rpush(key('queue'), test)
125
+ eval_script(REQUEUE, keys: [key('queue')], argv: [test, offset])
108
126
  ack(test)
109
127
  end
110
128
  end
@@ -1,5 +1,5 @@
1
1
  module CI
2
2
  module Queue
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -93,7 +93,7 @@ module Minitest
93
93
  end
94
94
  reporter.record(result)
95
95
  else
96
- raise SuiteNotFound, "Couldn't find suite matching: #{msg.inspect}"
96
+ raise SuiteNotFound, "Couldn't find suite matching: #{test_name}"
97
97
  end
98
98
  end
99
99
  end
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.2.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-18 00:00:00.000000000 Z
11
+ date: 2016-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler