Fixed a hang when the cleanup code for an extension is too slow

This commit is contained in:
2026-01-20 15:24:34 +01:00
parent cb111a8d7b
commit 237b40ed2e
6 changed files with 274 additions and 270 deletions

View File

@@ -18,7 +18,7 @@ use memo_map::MemoMap;
use never::Never;
use orchid_api_traits::{Decode, Encode, enc_vec};
use orchid_base::error::OrcRes;
use orchid_base::format::{FmtCtx, FmtCtxImpl, FmtUnit, take_first};
use orchid_base::format::{FmtCtx, FmtCtxImpl, FmtUnit, Format, take_first};
use orchid_base::logging::log;
use orchid_base::name::Sym;
use task_local::task_local;
@@ -93,10 +93,28 @@ impl<T: OwnedAtom> AtomDynfo for OwnedAtomDynfo<T> {
})
}
fn call(&self, AtomCtx(_, id): AtomCtx, arg: Expr) -> LocalBoxFuture<'_, GExpr> {
Box::pin(async move { take_atom(id.unwrap()).await.dyn_call(arg).await })
Box::pin(async move {
writeln!(
log("msg"),
"owned call {} {}",
take_first(&AtomReadGuard::new(id.unwrap()).await.dyn_print().await, false),
take_first(&arg.print(&FmtCtxImpl::default()).await, true),
)
.await;
take_atom(id.unwrap()).await.dyn_call(arg).await
})
}
fn call_ref<'a>(&'a self, AtomCtx(_, id): AtomCtx<'a>, arg: Expr) -> LocalBoxFuture<'a, GExpr> {
Box::pin(async move { AtomReadGuard::new(id.unwrap()).await.dyn_call_ref(arg).await })
Box::pin(async move {
writeln!(
log("msg"),
"owned call_ref {} {}",
take_first(&AtomReadGuard::new(id.unwrap()).await.dyn_print().await, false),
take_first(&arg.print(&FmtCtxImpl::default()).await, true),
)
.await;
AtomReadGuard::new(id.unwrap()).await.dyn_call_ref(arg).await
})
}
fn print(&self, AtomCtx(_, id): AtomCtx<'_>) -> LocalBoxFuture<'_, FmtUnit> {
Box::pin(async move { AtomReadGuard::new(id.unwrap()).await.dyn_print().await })