mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
refactor: Make ConnectivityStore use a non-async lock (#7129)
Follow-up to https://github.com/chatmail/core/pull/7125: We now have a mix of non-async (parking_lot) and async (tokio) Mutexes used for the connectivity. We can just use non-async Mutexes, because we don't attempt to hold them over an await point. I also tested that we get a compiler error if we do try to hold one over an await point (rather than just deadlocking/blocking the executor on runtime). Not 100% sure about using the parking_lot rather than std Mutex, because since https://github.com/rust-lang/rust/issues/93740, parking_lot doesn't have a lot of advantages anymore. But as long as iroh depends on it, we might as well use it ourselves.
This commit is contained in:
@@ -1908,7 +1908,7 @@ impl CommandApi {
|
||||
/// If the connectivity changes, a #DC_EVENT_CONNECTIVITY_CHANGED will be emitted.
|
||||
async fn get_connectivity(&self, account_id: u32) -> Result<u32> {
|
||||
let ctx = self.get_context(account_id).await?;
|
||||
Ok(ctx.get_connectivity().await as u32)
|
||||
Ok(ctx.get_connectivity() as u32)
|
||||
}
|
||||
|
||||
/// Get an overview of the current connectivity, and possibly more statistics.
|
||||
|
||||
Reference in New Issue
Block a user