Class: CI::Queue::Redis::Retry

Inherits:
Static
  • Object
show all
Defined in:
lib/ci/queue/redis/retry.rb

Constant Summary

Constants inherited from Static

Static::TEN_MINUTES

Constants included from Common

Common::CONNECTION_ERRORS

Instance Attribute Summary

Attributes inherited from Static

#entry_resolver, #progress, #total

Attributes included from Common

#config

Instance Method Summary collapse

Methods inherited from Static

#boot_heartbeat_process!, #created_at=, #distributed?, #ensure_heartbeat_thread_alive!, #exhausted?, #expired?, from_uri, #increment_test_failed, #lease_for, #max_test_failed?, #poll, #populate, #populated?, #queue_initialized?, #remaining, #report_worker_error, #requeue, #retry_queue, #running, #shutdown!, #size, #stop_heartbeat!, #supervisor, #test_failed, #to_a, #with_heartbeat

Methods included from Common

#distributed?, #flaky?, #release!, #report_failure!, #report_success!, #rescue_connection_errors, #retrying?

Constructor Details

#initialize(tests, config, redis:) ⇒ Retry

Returns a new instance of Retry.



6
7
8
9
# File 'lib/ci/queue/redis/retry.rb', line 6

def initialize(tests, config, redis:)
  @redis = redis
  super(tests, config)
end

Instance Method Details

#acknowledge(entry, error: nil, pipeline: redis) ⇒ Object

Queue a Redis SADD so that BuildRecord#record_success can include this in its multi-exec transaction. Without this, Static#acknowledge returns a Ruby value (not a Redis future), shifting the result indices and breaking the stats delta correction.



35
36
37
38
39
40
# File 'lib/ci/queue/redis/retry.rb', line 35

def acknowledge(entry, error: nil, pipeline: redis)
  @progress += 1
  return @progress unless pipeline
  test_id = CI::Queue::QueueEntry.test_id(entry)
  pipeline.sadd(key('processed'), test_id)
end

#buildObject



11
12
13
# File 'lib/ci/queue/redis/retry.rb', line 11

def build
  @build ||= CI::Queue::Redis::BuildRecord.new(self, redis, config)
end

#stream_populate(tests, random: nil, batch_size: nil) ⇒ Object

Retry queue is pre-populated with failed test entries from the previous run. Don’t replace them with the full preresolved/lazy test list. QueuePopulationStrategy#configure_lazy_queue will still set entry_resolver, so poll uses LazyEntryResolver to lazily load test files on demand. The random/batch_size params are intentionally ignored since we keep the existing queue contents as-is.

Note: populate (non-stream) is intentionally NOT overridden here. RSpec and non-lazy Minitest retries call populate to build the yield proper test/example instances. In those paths, @queue contains bare test IDs that match @index keys, so populate works correctly.



27
28
29
# File 'lib/ci/queue/redis/retry.rb', line 27

def stream_populate(tests, random: nil, batch_size: nil)
  self
end