diff options
author | Hristo Venev <hristo@venev.name> | 2019-03-19 20:10:51 +0200 |
---|---|---|
committer | Hristo Venev <hristo@venev.name> | 2019-03-19 20:10:51 +0200 |
commit | d64ffe0b4e3ef6a86401f80f0c7717770c2ccbd1 (patch) | |
tree | 431e19b0ae95b0dc8d27604340f0fb3af6aaceca | |
parent | 51c9e1433bf139759a41173aa63fa40855a10fac (diff) |
Make retry and refresh messages nicer.
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/main.rs | 10 |
2 files changed, 6 insertions, 6 deletions
@@ -1,6 +1,6 @@ [package] name = "wgconfd" -version = "0.1.0" +version = "0.1.1" authors = ["Hristo Venev <hristo@venev.name>"] edition = "2018" diff --git a/src/main.rs b/src/main.rs index 15ca6d5..0dbb235 100644 --- a/src/main.rs +++ b/src/main.rs @@ -123,8 +123,6 @@ impl Device { Err(r) => r, }; - eprintln!("<3>Failed to update [{}]: {}", &src.config.url, &r); - let b = src.backoff.unwrap_or(if src.data.is_some() { refresh / 3 } else { @@ -132,8 +130,10 @@ impl Device { }); src.next_update = now + b; t_refresh = t_refresh.min(src.next_update); - let b = (b + b / 3).min(refresh); - src.backoff = Some(b); + + eprintln!("<3>Failed to update [{}], retrying after {:?}: {}", &src.config.url, b, &r); + + src.backoff = Some((b + b / 3).min(refresh)); } let now = Instant::now(); @@ -158,9 +158,9 @@ impl Device { eprintln!("<6>Next configuration update after {:?}", time_to_cfg); t_cfg } else if t_refresh > now { - eprintln!("<6>Next refresh after {:?}", t_refresh.duration_since(now)); t_refresh } else { + eprintln!("<4>Next refresh immediately?"); now }) } |