add server.remove_good_host(..)
we'll use this later in gc jobs to clean up any hosts that have been consistently down or whatevermain
parent
a1ffb5cdc4
commit
35558748fa
10
src/lib.rs
10
src/lib.rs
|
@ -53,7 +53,17 @@ impl RelayServer {
|
||||||
let hosts_copy = hosts.iter().collect::<Vec<_>>();
|
let hosts_copy = hosts.iter().collect::<Vec<_>>();
|
||||||
let serialized_hosts = serde_ipld_dagcbor::to_vec(&hosts_copy)?;
|
let serialized_hosts = serde_ipld_dagcbor::to_vec(&hosts_copy)?;
|
||||||
drop(hosts);
|
drop(hosts);
|
||||||
|
self.db.insert("hosts", serialized_hosts)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn remove_good_host(&self, host: String) -> Result<()> {
|
||||||
|
tracing::debug!(%host, "dropping known-good host");
|
||||||
|
let mut hosts = self.known_good_hosts.lock().await;
|
||||||
|
hosts.remove(&host);
|
||||||
|
let hosts_copy = hosts.iter().collect::<Vec<_>>();
|
||||||
|
let serialized_hosts = serde_ipld_dagcbor::to_vec(&hosts_copy)?;
|
||||||
|
drop(hosts);
|
||||||
self.db.insert("hosts", serialized_hosts)?;
|
self.db.insert("hosts", serialized_hosts)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue