11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/debci/collector.rb', line 11
def run
channel = Debci::AMQP.amqp_channel
queue = Debci::AMQP.results_queue
queue.subscribe(manual_ack: true) do |delivery_info, _properties, payload|
Dir.mktmpdir do |dir|
Dir.chdir(dir) do
results = Pathname('results.tar.gz')
results.open('wb') do |f|
f.write(payload)
end
system("tar xaf #{results}")
results.unlink
end
results_dir = Pathname(dir).glob('**/exitcode').first.parent
receive(results_dir)
channel.acknowledge(delivery_info.delivery_tag, false)
end
end
begin
loop { sleep 1 }
rescue Interrupt
puts
puts "debci collector stopped"
end
end
|