about summary refs log tree commit diff
path: root/ops/gerrit-autosubmit/src/main.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2024-01-03T19·55+0300
committerclbot <clbot@tvl.fyi>2024-01-03T20·28+0000
commit15309c7debfeb94977d1622dc6ed604d32710435 (patch)
treea40433629bb32a44af16b5ce746439b79e687f27 /ops/gerrit-autosubmit/src/main.rs
parent20c894e232ab75b3ad79d1e8a8b3c47ba1394af2 (diff)
chore(ops/gerrit-autosubmit): clean up warnings & clippy lints r/7337
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>
Diffstat (limited to 'ops/gerrit-autosubmit/src/main.rs')
-rw-r--r--ops/gerrit-autosubmit/src/main.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/ops/gerrit-autosubmit/src/main.rs b/ops/gerrit-autosubmit/src/main.rs
index 9d7087d67deb..85d8a6af61bb 100644
--- a/ops/gerrit-autosubmit/src/main.rs
+++ b/ops/gerrit-autosubmit/src/main.rs
@@ -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));
         }
     }
 }