From 000094e9c4e126ca8036abafa55d639cbc714c3e Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Sun, 31 Mar 2024 14:13:20 -0400 Subject: [PATCH] attempt blocking at getchannel failed --- src/core/bot_actions.rs | 10 ++++++++++ src/custom/experimental/experiment003.rs | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/core/bot_actions.rs b/src/core/bot_actions.rs index fae3d3b..9ad7eea 100644 --- a/src/core/bot_actions.rs +++ b/src/core/bot_actions.rs @@ -51,6 +51,7 @@ impl ExecBodyParams { } pub async fn get_channel(&self) -> Option { + // pub fn get_channel(&self) -> Option { dbg!("Core > ExecBodyParams > GetChannels START"); dbg!("!! [x] Document - After SUCCESS message was sent to chat"); @@ -63,6 +64,14 @@ impl ExecBodyParams { let curr_act = Arc::clone(&self.curr_act); let curr_act_lock = curr_act.read().await; + // Note : The below `curr_act.blocking_read()` is not possible. I get the following + // during runtime in this areas + /* + thread 'tokio-runtime-worker' panicked at src\core\bot_actions.rs:66:38: +Cannot block the current thread from within a runtime. This happens because a function attempted to block the current thread while the thread is being used to drive asynchronous tasks. + */ + // let curr_act_lock = curr_act.blocking_read(); + dbg!("Core > ExecBodyParams > After Creating ExecBodyParams.current_act.read() Guard "); dbg!("!! [x] Document - After SUCCESS message was sent to chat"); dbg!(">> BotActionAR - RwLock from botmodules.rs::929:46 - current_readers = 1 "); @@ -105,6 +114,7 @@ impl ExecBodyParams { // let out = Some(r.read().await.channel.clone()); let guard = r.read().await; + // let guard = r.blocking_read(); dbg!("ISSUE> Never makes it after the read guard"); diff --git a/src/custom/experimental/experiment003.rs b/src/custom/experimental/experiment003.rs index 0be50a3..774e24b 100644 --- a/src/custom/experimental/experiment003.rs +++ b/src/custom/experimental/experiment003.rs @@ -141,6 +141,7 @@ async fn countdown_chnl_v1(params : ExecBodyParams) { // let parentmodule = params.get_parent_module().await; let module = params.get_module().await; + // let channel = params.get_channel().await; let channel = params.get_channel().await; let routine_attr = vec![ // RoutineAttr::RunOnce @@ -359,6 +360,7 @@ async fn test3_body(params : ExecBodyParams) { // let parentmodule = params.get_parent_module().await; let module = params.get_module().await; + // let channel = params.get_channel().await; let channel = params.get_channel().await; let routine_attr = vec![ RoutineAttr::RunOnce @@ -436,6 +438,7 @@ async fn test3_body(params : ExecBodyParams) { // BotAction::C(_) | BotAction::L(_) => None , // } ; + // let chnl = params.get_channel().await; let chnl = params.get_channel().await; dbg!("Custom > within Child Custom fn - after GetChannel"); println!("{:?}",chnl);