WIP: Routine Unresponsive due to Deadlock #51
1 changed files with 5 additions and 0 deletions
|
@ -279,6 +279,11 @@ async fn countdown_chnl_v1(params : ExecBodyParams) {
|
|||
);
|
||||
Log::flush();
|
||||
|
||||
// [ ] !! ISSUE : With this fix though, the custom fn is no longer
|
||||
// async. This is an issue because chat module is async
|
||||
// - There should be no need to change chat , as async allows
|
||||
// us to multitask with messages
|
||||
|
||||
|
||||
// let a = || {
|
||||
|
||||
// let chosen_channel_ar = Arc::new(RwLock::new(chosen_channel));
|
||||
|
|
Loading…
Reference in a new issue
Issue with the Fix
If child Routine
fn
are defined as regularfn
rather thanasync
, Custom Routinefn
would not be able to callChat.say()
or similar functionalityHere for example, in a Custom Routine
fn innertester(params : Arc<RwLock<ExecBodyParams>>
, we can't callchat.say()
in this areaHonestly I'm favoring keeping the fox and maybe enhancing
Chat
so it has non-async calls forsay()
.Keep in mind in implementing, we cannot call
async
calls in a blocking context. This means if I have a nonasync
code block, code calls (e.g.fn
) cannot be awaited on. In other words in non Async fn, I cannot useclient.send().await
. There are ways around this though (later notes)I don't foresee issues with multitasking here if we enhance
Chat
so users essentially enqueue "messages" (consisting ofBotMsgType
andExecParams
) then the bot has a separatetokio::task
running that processes those messages (i.e., triggering the message using giventwitch-irc
call likeclient.say()
)In addition with in place, when custom module developers define a routine, they don't have to worry about locks as within the context of a custom built
Routine
(in theory) should be blockingcore
levelI'm thinking of using
async-channel
cratehttps://docs.rs/async-channel/latest/async_channel/fn.bounded.html