From 5a6a8a0931e4809b10971f77026a4d53adba2d1d Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Sat, 16 Sep 2023 15:07:01 -0500 Subject: [PATCH] Add note about smol and async-executor in scheduler struct --- src/lune/scheduler/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lune/scheduler/mod.rs b/src/lune/scheduler/mod.rs index df1a0875..67c7799c 100644 --- a/src/lune/scheduler/mod.rs +++ b/src/lune/scheduler/mod.rs @@ -44,8 +44,12 @@ pub(crate) struct Scheduler<'fut> { state and receiver to know when we have run to completion. If we have no senders left, we have run to completion. - Once we no longer store futures in our scheduler, we can - get rid of the lifetime on it, store it in our lua app + We should also investigate using smol / async-executor and its + LocalExecutor struct which does not impose the 'static lifetime + restriction on all of the futures spawned on it, unlike tokio. + + If we no longer store futures directly in our scheduler, we + can get rid of the lifetime on it, store it in our lua app data as a Weak, together with a Weak. In our lua async functions we can then get a reference to this,