mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-24 10:31:04 +00:00
Fix build
This commit is contained in:
parent
21883c168b
commit
b577730836
2 changed files with 22 additions and 22 deletions
|
@ -299,7 +299,7 @@ impl Inner {
|
||||||
.entry(labels)
|
.entry(labels)
|
||||||
.or_insert_with(Summary::with_defaults);
|
.or_insert_with(Summary::with_defaults);
|
||||||
|
|
||||||
let h = histogram.get_inner().clear_with(|samples| {
|
histogram.get_inner().clear_with(|samples| {
|
||||||
for sample in samples {
|
for sample in samples {
|
||||||
entry.add(*sample);
|
entry.add(*sample);
|
||||||
}
|
}
|
||||||
|
@ -311,8 +311,6 @@ impl Inner {
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics::gauge!("relay.collector.distributions.size").set(recordable(total_len));
|
metrics::gauge!("relay.collector.distributions.size").set(recordable(total_len));
|
||||||
|
|
||||||
h
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let d = self.distributions.read().unwrap().clone();
|
let d = self.distributions.read().unwrap().clone();
|
||||||
|
|
40
src/db.rs
40
src/db.rs
|
@ -605,28 +605,30 @@ impl Db {
|
||||||
|
|
||||||
pub(crate) async fn add_blocks(&self, domains: Vec<String>) -> Result<(), Error> {
|
pub(crate) async fn add_blocks(&self, domains: Vec<String>) -> Result<(), Error> {
|
||||||
self.unblock(move |inner| {
|
self.unblock(move |inner| {
|
||||||
let mut connected_batch = Batch::default();
|
|
||||||
let mut blocked_batch = Batch::default();
|
|
||||||
let mut allowed_batch = Batch::default();
|
|
||||||
|
|
||||||
for connected in inner.connected_by_domain(&domains) {
|
|
||||||
connected_batch.remove(connected.as_str().as_bytes());
|
|
||||||
}
|
|
||||||
|
|
||||||
for authority in &domains {
|
|
||||||
blocked_batch.insert(domain_key(authority), authority.as_bytes());
|
|
||||||
allowed_batch.remove(domain_key(authority));
|
|
||||||
}
|
|
||||||
|
|
||||||
let res = (
|
let res = (
|
||||||
&inner.connected_actor_ids,
|
&inner.connected_actor_ids,
|
||||||
&inner.blocked_domains,
|
&inner.blocked_domains,
|
||||||
&inner.allowed_domains,
|
&inner.allowed_domains,
|
||||||
)
|
)
|
||||||
.transaction(|(connected, blocked, allowed)| {
|
.transaction(|(connected, blocked, allowed)| {
|
||||||
inner.connected_actor_ids.apply_batch(&connected_batch)?;
|
let mut connected_batch = Batch::default();
|
||||||
inner.blocked_domains.apply_batch(&blocked_batch)?;
|
let mut blocked_batch = Batch::default();
|
||||||
inner.allowed_domains.apply_batch(&allowed_batch)?;
|
let mut allowed_batch = Batch::default();
|
||||||
|
|
||||||
|
for connected in inner.connected_by_domain(&domains) {
|
||||||
|
connected_batch.remove(connected.as_str().as_bytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
for authority in &domains {
|
||||||
|
blocked_batch
|
||||||
|
.insert(domain_key(authority).as_bytes(), authority.as_bytes());
|
||||||
|
allowed_batch.remove(domain_key(authority).as_bytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
connected.apply_batch(&connected_batch)?;
|
||||||
|
blocked.apply_batch(&blocked_batch)?;
|
||||||
|
allowed.apply_batch(&allowed_batch)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -651,7 +653,7 @@ impl Db {
|
||||||
let mut blocked_batch = Batch::default();
|
let mut blocked_batch = Batch::default();
|
||||||
|
|
||||||
for authority in &domains {
|
for authority in &domains {
|
||||||
blocked_batch.remove(domain_key(authority));
|
blocked_batch.remove(domain_key(authority).as_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
inner.blocked_domains.apply_batch(blocked_batch)?;
|
inner.blocked_domains.apply_batch(blocked_batch)?;
|
||||||
|
@ -669,7 +671,7 @@ impl Db {
|
||||||
let mut allowed_batch = Batch::default();
|
let mut allowed_batch = Batch::default();
|
||||||
|
|
||||||
for authority in &domains {
|
for authority in &domains {
|
||||||
allowed_batch.insert(domain_key(authority), authority.as_bytes());
|
allowed_batch.insert(domain_key(authority).as_bytes(), authority.as_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
inner.allowed_domains.apply_batch(allowed_batch)?;
|
inner.allowed_domains.apply_batch(allowed_batch)?;
|
||||||
|
@ -701,7 +703,7 @@ impl Db {
|
||||||
let mut allowed_batch = Batch::default();
|
let mut allowed_batch = Batch::default();
|
||||||
|
|
||||||
for authority in &domains {
|
for authority in &domains {
|
||||||
allowed_batch.remove(domain_key(authority));
|
allowed_batch.remove(domain_key(authority).as_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
inner.allowed_domains.apply_batch(allowed_batch)?;
|
inner.allowed_domains.apply_batch(allowed_batch)?;
|
||||||
|
|
Loading…
Reference in a new issue