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:
Hocuri
2025-08-23 21:08:17 +02:00
committed by GitHub
parent c34ccafb2e
commit 2cd54b72b0
6 changed files with 47 additions and 49 deletions

View File

@@ -87,7 +87,7 @@ impl Smtp {
return Ok(());
}
self.connectivity.set_connecting(context).await;
self.connectivity.set_connecting(context);
let lp = ConfiguredLoginParam::load(context)
.await?
.context("Not configured")?;
@@ -187,7 +187,7 @@ pub(crate) async fn smtp_send(
info!(context, "SMTP-sending out mime message:\n{message}");
}
smtp.connectivity.set_working(context).await;
smtp.connectivity.set_working(context);
if let Err(err) = smtp
.connect_configured(context)