mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-25 02:51:12 +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();
|
||||||
|
|
30
src/db.rs
30
src/db.rs
|
@ -605,6 +605,12 @@ 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 res = (
|
||||||
|
&inner.connected_actor_ids,
|
||||||
|
&inner.blocked_domains,
|
||||||
|
&inner.allowed_domains,
|
||||||
|
)
|
||||||
|
.transaction(|(connected, blocked, allowed)| {
|
||||||
let mut connected_batch = Batch::default();
|
let mut connected_batch = Batch::default();
|
||||||
let mut blocked_batch = Batch::default();
|
let mut blocked_batch = Batch::default();
|
||||||
let mut allowed_batch = Batch::default();
|
let mut allowed_batch = Batch::default();
|
||||||
|
@ -614,19 +620,15 @@ impl Db {
|
||||||
}
|
}
|
||||||
|
|
||||||
for authority in &domains {
|
for authority in &domains {
|
||||||
blocked_batch.insert(domain_key(authority), authority.as_bytes());
|
blocked_batch
|
||||||
allowed_batch.remove(domain_key(authority));
|
.insert(domain_key(authority).as_bytes(), authority.as_bytes());
|
||||||
|
allowed_batch.remove(domain_key(authority).as_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = (
|
connected.apply_batch(&connected_batch)?;
|
||||||
&inner.connected_actor_ids,
|
blocked.apply_batch(&blocked_batch)?;
|
||||||
&inner.blocked_domains,
|
allowed.apply_batch(&allowed_batch)?;
|
||||||
&inner.allowed_domains,
|
|
||||||
)
|
|
||||||
.transaction(|(connected, blocked, allowed)| {
|
|
||||||
inner.connected_actor_ids.apply_batch(&connected_batch)?;
|
|
||||||
inner.blocked_domains.apply_batch(&blocked_batch)?;
|
|
||||||
inner.allowed_domains.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