prevent releasing keys logspam

This commit is contained in:
Ferdinand Schober
2024-09-10 11:34:46 +02:00
parent 89a4672d36
commit b747c7252b

View File

@@ -58,12 +58,15 @@ impl Emulation {
} }
} }
_ = interval.tick() => { _ = interval.tick() => {
for (addr, last_response) in last_response.iter() { let _ = last_response.retain(|addr,instant| {
if last_response.elapsed() > Duration::from_secs(5) { if instant.elapsed() > Duration::from_secs(5) {
log::warn!("{addr} is not responding, releasing keys!"); log::warn!("{addr} is not responding, releasing keys!");
emulation_proxy.release_keys(*addr); emulation_proxy.release_keys(*addr);
false
} else {
true
} }
} });
} }
_ = server.cancelled() => break, _ = server.cancelled() => break,
} }