chore(ops/gerrit-autosubmit): clean up warnings & clippy lints
Change-Id: I0e914d093b8fb45fa85bb19fb68c4f84f5ba6336 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10531 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
parent
20c894e232
commit
15309c7deb
1 changed files with 5 additions and 4 deletions
|
@ -20,6 +20,7 @@
|
|||
|
||||
use anyhow::{Context, Result};
|
||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
use std::{thread, time};
|
||||
|
||||
mod gerrit {
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
|
@ -59,7 +60,7 @@ mod gerrit {
|
|||
pub enabled: bool,
|
||||
}
|
||||
|
||||
const GERRIT_RESPONSE_PREFIX: &'static str = ")]}'";
|
||||
const GERRIT_RESPONSE_PREFIX: &str = ")]}'";
|
||||
|
||||
pub fn get<T: serde::de::DeserializeOwned>(cfg: &Config, endpoint: &str) -> Result<T> {
|
||||
let response = crimp::Request::get(&format!("{}/a{}", cfg.gerrit_url, endpoint))
|
||||
|
@ -73,7 +74,7 @@ mod gerrit {
|
|||
}
|
||||
|
||||
pub fn submit(cfg: &Config, change_id: &str) -> Result<()> {
|
||||
let response = crimp::Request::post(&format!(
|
||||
crimp::Request::post(&format!(
|
||||
"{}/a/changes/{}/submit",
|
||||
cfg.gerrit_url, change_id
|
||||
))
|
||||
|
@ -173,7 +174,7 @@ fn autosubmit(cfg: &gerrit::Config) -> Result<bool> {
|
|||
change_id, count
|
||||
);
|
||||
|
||||
gerrit::submit(cfg, change_id);
|
||||
gerrit::submit(cfg, change_id).context("while submitting")?;
|
||||
|
||||
Ok(true)
|
||||
} else {
|
||||
|
@ -187,7 +188,7 @@ fn main() -> Result<()> {
|
|||
|
||||
loop {
|
||||
if !autosubmit(&cfg)? {
|
||||
std::thread::sleep_ms(30000);
|
||||
thread::sleep(time::Duration::from_secs(30));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue