chiark / gitweb /
make success_report_interval configuraable
[hippotat.git] / src / reporter.rs
index fb12e63335229fcd5fe50c5fdf1d9656c6428a6b..24cd6b82822f44756b3b95aafc725e18a4445251 100644 (file)
@@ -4,6 +4,7 @@
 
 use crate::prelude::*;
 
+// For clients only, really.
 pub struct Reporter<'r> {
   ic: &'r InstanceConfig,
   successes: u64,
@@ -33,8 +34,11 @@ impl<'r> Reporter<'r> {
     let now = Instant::now();
     if let Some(rep) = &self.last_report {
       if now - rep.when < match rep.ok {
-        Ok(()) => Duration::from_secs(3600), // xxx config?
-        Err(()) => Duration::from_secs(30), // xxx config?
+        Ok(()) => match self.ic.success_report_interval {
+          z if z == Duration::default() => return,
+          nonzero => nonzero,
+        },
+        Err(()) => self.ic.effective_http_timeout,
       } {
         return
       }