Properly handle empty catalog (absent node)

This commit is contained in:
Alex 2023-01-05 11:31:01 +01:00
parent a0e276a629
commit 63ebd97c7c
Signed by: lx
GPG key ID: 0E496D15096376BE
3 changed files with 4 additions and 4 deletions

4
Cargo.lock generated
View file

@ -114,9 +114,9 @@ dependencies = [
[[package]] [[package]]
name = "df-consul" name = "df-consul"
version = "0.1.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ec5111d5daddfbab491780564dc8270c29c90553fab98d677489600a8623c76" checksum = "a351d00f138e768845cdefb9ae27b79aeed97c698745c73bb2805cad1167aa81"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",

View file

@ -12,7 +12,7 @@ anyhow = "1.0.66"
futures = "0.3" futures = "0.3"
tracing = { version = "0.1.30" } tracing = { version = "0.1.30" }
tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] }
df-consul = "0.1.0" df-consul = "0.2.0"
structopt = "0.3" structopt = "0.3"
tokio = { version = "1.22", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] } tokio = { version = "1.22", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] }
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls-webpki-roots" ] } reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls-webpki-roots" ] }

View file

@ -185,7 +185,7 @@ pub fn spawn_dns_config_task(
Ok((catalog, new_idx)) => { Ok((catalog, new_idx)) => {
let mut watch_state = nodes.get_mut(&node).unwrap(); let mut watch_state = nodes.get_mut(&node).unwrap();
watch_state.last_idx = Some(new_idx); watch_state.last_idx = Some(new_idx);
watch_state.last_catalog = Some(catalog); watch_state.last_catalog = catalog;
watch_state.retries = 0; watch_state.retries = 0;
let idx = watch_state.last_idx; let idx = watch_state.last_idx;