Begin accepting build results on the log queues
This commit is contained in:
parent
a796200325
commit
4f9258c3b6
|
@ -189,12 +189,20 @@ impl<'a, 'b> JobActions<'a, 'b> {
|
|||
|
||||
let result_exchange = self.result_exchange.clone();
|
||||
let result_routing_key = self.result_routing_key.clone();
|
||||
|
||||
self.tell(worker::publish_serde_action(
|
||||
result_exchange,
|
||||
result_routing_key,
|
||||
&msg,
|
||||
));
|
||||
|
||||
let log_exchange = self.log_exchange.clone();
|
||||
let log_routing_key = self.log_routing_key.clone();
|
||||
self.tell(worker::publish_serde_action(
|
||||
log_exchange,
|
||||
log_routing_key,
|
||||
&msg,
|
||||
));
|
||||
|
||||
self.tell(worker::Action::Ack);
|
||||
}
|
||||
|
||||
|
@ -216,12 +224,20 @@ impl<'a, 'b> JobActions<'a, 'b> {
|
|||
|
||||
let result_exchange = self.result_exchange.clone();
|
||||
let result_routing_key = self.result_routing_key.clone();
|
||||
|
||||
self.tell(worker::publish_serde_action(
|
||||
result_exchange,
|
||||
result_routing_key,
|
||||
&msg,
|
||||
));
|
||||
|
||||
let log_exchange = self.log_exchange.clone();
|
||||
let log_routing_key = self.log_routing_key.clone();
|
||||
self.tell(worker::publish_serde_action(
|
||||
log_exchange,
|
||||
log_routing_key,
|
||||
&msg,
|
||||
));
|
||||
|
||||
self.tell(worker::Action::Ack);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use std::io::Write;
|
|||
|
||||
use ofborg::writetoline::LineWriter;
|
||||
use ofborg::message::buildlogmsg::{BuildLogStart, BuildLogMsg};
|
||||
use ofborg::message::buildresult::BuildResult;
|
||||
use ofborg::worker;
|
||||
use amqp::protocol::basic::{Deliver, BasicProperties};
|
||||
|
||||
|
@ -28,6 +29,7 @@ pub struct LogMessageCollector {
|
|||
enum MsgType {
|
||||
Start(BuildLogStart),
|
||||
Msg(BuildLogMsg),
|
||||
Finish(BuildResult),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -176,7 +178,13 @@ impl worker::SimpleWorker for LogMessageCollector {
|
|||
attempt_id = msg.attempt_id.clone();
|
||||
message = MsgType::Start(msg);
|
||||
} else {
|
||||
return Err(format!("failed to decode job: {:?}", decode_msg));
|
||||
let decode_msg: Result<BuildResult, _> = serde_json::from_slice(body);
|
||||
if let Ok(msg) = decode_msg {
|
||||
attempt_id = msg.attempt_id.clone();
|
||||
message = MsgType::Finish(msg);
|
||||
} else {
|
||||
return Err(format!("failed to decode job: {:?}", decode_msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue