@@ -48,16 +48,10 @@ def master?
48
48
49
49
def poll
50
50
wait_for_master
51
- last_heartbeat_time = Time . now
52
51
until shutdown_required? || config . circuit_breakers . any? ( &:open? ) || exhausted? || max_test_failed?
53
52
if test = reserve
54
53
yield index . fetch ( test )
55
54
else
56
- # Log heartbeat every 5 minutes if this is the master process
57
- if master? && Time . now - last_heartbeat_time > 300
58
- puts '[ci-queue] Still working'
59
- last_heartbeat_time = Time . now
60
- end
61
55
sleep 0.05
62
56
end
63
57
end
@@ -209,34 +203,15 @@ def push(tests)
209
203
210
204
if @master = redis . setnx ( key ( 'master-status' ) , 'setup' )
211
205
puts "Worker electected as leader, pushing #{ @total } tests to the queue."
212
- puts
213
-
214
- attempts = 0
215
- duration = measure do
216
- with_redis_timeout ( 5 ) do
217
- redis . without_reconnect do
218
- redis . multi do |transaction |
219
- transaction . lpush ( key ( 'queue' ) , tests ) unless tests . empty?
220
- transaction . set ( key ( 'total' ) , @total )
221
- transaction . set ( key ( 'master-status' ) , 'ready' )
222
-
223
- transaction . expire ( key ( 'queue' ) , config . redis_ttl )
224
- transaction . expire ( key ( 'total' ) , config . redis_ttl )
225
- transaction . expire ( key ( 'master-status' ) , config . redis_ttl )
226
- end
227
- end
228
- rescue ::Redis ::BaseError => error
229
- if !queue_initialized? && attempts < 3
230
- puts "Retrying pushing #{ @total } tests to the queue... (#{ error } )"
231
- attempts += 1
232
- retry
233
- end
234
-
235
- raise if !queue_initialized?
236
- end
206
+ redis . multi do |transaction |
207
+ transaction . lpush ( key ( 'queue' ) , tests ) unless tests . empty?
208
+ transaction . set ( key ( 'total' ) , @total )
209
+ transaction . set ( key ( 'master-status' ) , 'ready' )
210
+
211
+ transaction . expire ( key ( 'queue' ) , config . redis_ttl )
212
+ transaction . expire ( key ( 'total' ) , config . redis_ttl )
213
+ transaction . expire ( key ( 'master-status' ) , config . redis_ttl )
237
214
end
238
-
239
- puts "Finished pushing #{ @total } tests to the queue in #{ duration . round ( 2 ) } s."
240
215
end
241
216
register
242
217
redis . expire ( key ( 'workers' ) , config . redis_ttl )
0 commit comments