23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/prebake/async_publisher.rb', line 23
def self.wait_for_completion(timeout: 120)
specs = @mutex.synchronize { @pending_specs.dup }
return if specs.empty?
Logger.info "Building #{specs.size} platform gem(s)..."
built_gems = specs.filter_map do |spec, backend|
build_gem(spec, backend)
end
if built_gems.any?
Logger.info "Pushing #{built_gems.size} gem(s) in background..."
push_threads = built_gems.map do |gem_path, cache_key, checksum, backend|
Thread.new do
backend.push(gem_path, cache_key, checksum)
rescue StandardError => e
Logger.warn "Push failed for #{cache_key}: #{e.message}"
ensure
FileUtils.rm_f(gem_path)
end
end
push_threads.each { |t| t.join(timeout) }
end
Logger.info "All pushes complete."
@mutex.synchronize { @pending_specs.clear }
end
|