@@ -219,8 +219,9 @@ def try_to_reserve_test
219219 key ( 'processed' ) ,
220220 key ( 'worker' , worker_id , 'queue' ) ,
221221 key ( 'owners' ) ,
222+ key ( 'test-group-timeout' ) ,
222223 ] ,
223- argv : [ CI ::Queue . time_now . to_f ] ,
224+ argv : [ CI ::Queue . time_now . to_f , 'true' , config . timeout ] ,
224225 )
225226 end
226227
@@ -232,8 +233,9 @@ def try_to_reserve_lost_test
232233 key ( 'completed' ) ,
233234 key ( 'worker' , worker_id , 'queue' ) ,
234235 key ( 'owners' ) ,
236+ key ( 'test-group-timeout' ) ,
235237 ] ,
236- argv : [ CI ::Queue . time_now . to_f , timeout ] ,
238+ argv : [ CI ::Queue . time_now . to_f , timeout , 'true' , config . timeout ] ,
237239 )
238240
239241 if lost_test . nil? && idle?
@@ -277,8 +279,8 @@ def register
277279
278280 def store_chunk_metadata ( chunks )
279281 # Batch operations to avoid exceeding Redis multi operation limits
280- # Each chunk requires 3 commands (set, expire, sadd), so batch conservatively
281- batch_size = 7 # 7 chunks = 21 commands + 1 expire = 22 commands per batch
282+ # Each chunk requires 4 commands (set, expire, sadd, hset ), so batch conservatively
283+ batch_size = 5 # 5 chunks = 20 commands + 2 expires = 22 commands per batch
282284
283285 chunks . each_slice ( batch_size ) do |chunk_batch |
284286 redis . multi do |transaction |
@@ -292,8 +294,14 @@ def store_chunk_metadata(chunks)
292294
293295 # Track all chunks for cleanup
294296 transaction . sadd ( key ( 'chunks' ) , chunk . id )
297+
298+ # Store dynamic timeout for this chunk
299+ # Timeout = default_timeout * number_of_tests
300+ chunk_timeout = config . timeout * chunk . test_count
301+ transaction . hset ( key ( 'test-group-timeout' ) , chunk . id , chunk_timeout )
295302 end
296303 transaction . expire ( key ( 'chunks' ) , config . redis_ttl )
304+ transaction . expire ( key ( 'test-group-timeout' ) , config . redis_ttl )
297305 end
298306 end
299307 end
0 commit comments