feat: Show active transaction handle count in !admin federation incoming-federation
This commit is contained in:
parent
9016cd11a6
commit
4657844d46
3 changed files with 14 additions and 2 deletions
|
|
@ -30,12 +30,15 @@ pub(super) async fn incoming_federation(&self) -> Result {
|
||||||
.federation_handletime
|
.federation_handletime
|
||||||
.read();
|
.read();
|
||||||
|
|
||||||
let mut msg = format!("Handling {} incoming pdus:\n", map.len());
|
let mut msg = format!(
|
||||||
|
"Handling {} incoming PDUs across {} active transactions:\n",
|
||||||
|
map.len(),
|
||||||
|
self.services.transaction_ids.txn_active_handle_count()
|
||||||
|
);
|
||||||
for (r, (e, i)) in map.iter() {
|
for (r, (e, i)) in map.iter() {
|
||||||
let elapsed = i.elapsed();
|
let elapsed = i.elapsed();
|
||||||
writeln!(msg, "{} {}: {}m{}s", r, e, elapsed.as_secs() / 60, elapsed.as_secs() % 60)?;
|
writeln!(msg, "{} {}: {}m{}s", r, e, elapsed.as_secs() / 60, elapsed.as_secs() % 60)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg
|
msg
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,8 @@ async fn process_inbound_transaction(
|
||||||
// value, returning an empty response may lie to the remote and make them
|
// value, returning an empty response may lie to the remote and make them
|
||||||
// think we processed it properly (and lose events), but we also can't return
|
// think we processed it properly (and lose events), but we also can't return
|
||||||
// an actual error.
|
// an actual error.
|
||||||
|
drop(sender);
|
||||||
|
services.transaction_ids.finish_federation_txn(&txn_key);
|
||||||
panic!("failed to handle incoming transaction");
|
panic!("failed to handle incoming transaction");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,13 @@ impl crate::Service for Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Service {
|
impl Service {
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn txn_active_handle_count(&self) -> usize {
|
||||||
|
let state = self.servername_txnid_active.read();
|
||||||
|
state.len()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn add_client_txnid(
|
pub fn add_client_txnid(
|
||||||
&self,
|
&self,
|
||||||
user_id: &UserId,
|
user_id: &UserId,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue