Convert the exchange / routing key types to Optional, as they should be

This commit is contained in:
Graham Christensen 2018-01-21 17:40:17 -05:00
parent d3857bd9ab
commit cc62b0cf1c
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
3 changed files with 10 additions and 10 deletions

View file

@ -8,7 +8,7 @@ pub struct BuildJob {
pub pr: Pr,
pub subset: Option<Subset>,
pub attrs: Vec<String>,
pub logs: Option<(String, String)>, // (Exchange, Routing Key)
pub logs: Option<(Option<String>, Option<String>)>, // (Exchange, Routing Key)
}
pub fn from(data: &Vec<u8>) -> Result<BuildJob, serde_json::error::Error> {

View file

@ -60,8 +60,8 @@ struct JobActions<'a, 'b> {
job: &'b buildjob::BuildJob,
line_counter: u64,
attempt_id: String,
log_exchange: String,
log_routing_key: String,
log_exchange: Option<String>,
log_routing_key: Option<String>,
}
impl<'a, 'b> JobActions<'a, 'b> {
@ -72,8 +72,8 @@ impl<'a, 'b> JobActions<'a, 'b> {
receiver: &'a mut notifyworker::NotificationReceiver,
) -> JobActions<'a, 'b> {
let (log_exchange, log_routing_key) = job.logs.clone().unwrap_or((
String::from("logs"),
String::from("build.log"),
Some(String::from("logs")),
Some(String::from("build.log")),
));
return JobActions {
@ -123,8 +123,8 @@ impl<'a, 'b> JobActions<'a, 'b> {
attempt_id: self.attempt_id.clone(),
};
let log_exchange = Some(self.log_exchange.clone());
let log_routing_key = Some(self.log_routing_key.clone());
let log_exchange = self.log_exchange.clone();
let log_routing_key = self.log_routing_key.clone();
self.tell(worker::publish_serde_action(
log_exchange,
@ -144,8 +144,8 @@ impl<'a, 'b> JobActions<'a, 'b> {
output: line.to_owned(),
};
let log_exchange = Some(self.log_exchange.clone());
let log_routing_key = Some(self.log_routing_key.clone());
let log_exchange = self.log_exchange.clone();
let log_routing_key = self.log_routing_key.clone();
self.tell(worker::publish_serde_action(
log_exchange,

View file

@ -121,7 +121,7 @@ impl worker::SimpleWorker for GitHubCommentWorker {
pr: pr_msg.clone(),
subset: Some(subset),
attrs: attrs,
logs: Some(("logs".to_owned(), logbackrk)),
logs: Some((Some("logs".to_owned()), Some(logbackrk.to_lowercase()))),
};
response.push(worker::publish_serde_action(