app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

commit 8cb3e8c3dbeaff4a104b2e1b512871fce8ce6d53
parent c07fe816cbceccc30cbae1b9b418e4c62dba7af1
Author: triesap <tyson@radroots.org>
Date:   Fri, 28 Aug 2026 02:11:13 +0000

fix(ffi): close keyring on owned runtime

Diffstat:
Mcore/crates/harvestcircle_ffi/src/host_runtime.rs | 8++++++++
Mcore/crates/harvestcircle_ffi/src/observer.rs | 16++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/core/crates/harvestcircle_ffi/src/host_runtime.rs b/core/crates/harvestcircle_ffi/src/host_runtime.rs @@ -98,6 +98,14 @@ impl HostRuntime { receiver.recv().map_err(|_| ()) } + pub(crate) async fn run<F>(&self, future: F) -> Result<F::Output, ()> + where + F: Future + Send + 'static, + F::Output: Send + 'static, + { + self.handle.spawn(future).await.map_err(|_| ()) + } + pub(crate) async fn shutdown(&self) -> Result<(), ()> { let sender = self.shutdown.lock().map_err(|_| ())?.take(); if let Some(sender) = sender { diff --git a/core/crates/harvestcircle_ffi/src/observer.rs b/core/crates/harvestcircle_ffi/src/observer.rs @@ -197,8 +197,20 @@ impl HarvestCircleAppCore { .close() .await .map_err(HarvestCircleError::from)?; - if let Some(keyring) = self.inner.keyring.as_ref() { - keyring.close().await.map_err(HarvestCircleError::from)?; + match ( + self.inner.keyring.as_ref(), + self.inner.host_runtime.as_ref(), + ) { + (Some(keyring), Some(runtime)) => { + let keyring = Arc::clone(keyring); + runtime + .run(async move { keyring.close().await }) + .await + .map_err(|()| closed_error())? + .map_err(HarvestCircleError::from)?; + } + (Some(_), None) => return Err(closed_error()), + (None, _) => {} } if let Some(runtime) = self.inner.host_runtime.as_ref() { runtime.shutdown().await.map_err(|()| closed_error())?;