make work on rust < 1.70

This commit is contained in:
phiresky 2023-07-04 12:25:50 +00:00
parent e9f01583a4
commit 5058d1aba6

View file

@ -195,8 +195,13 @@ impl<T: Clone> FederationConfig<T> {
.activity_queue
.take()
.context("ActivityQueue never constructed, build() not called?")?;
let stats = Arc::<ActivityQueue>::into_inner(q)
.context("Could not cleanly shut down: activityqueue arc was still in use elsewhere ")?
// Todo: use Arc::into_inner but is only part of rust 1.70.
let stats = Arc::<ActivityQueue>::try_unwrap(q)
.map_err(|_| {
anyhow::anyhow!(
"Could not cleanly shut down: activityqueue arc was still in use elsewhere "
)
})?
.shutdown(wait_retries)
.await?;
return Ok(stats);