(init) solution

This commit is contained in:
ModulatingForce 2024-03-24 22:55:38 -04:00
parent afd7b7d387
commit ab5624c6fa

View file

@ -464,29 +464,58 @@ impl Chat {
// pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String) {
#[async_recursion]
// #[async_recursion]
pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String , params : ExecBodyParams) {
let botclone = Arc::clone(&params.bot);
let params_clone = params.clone();
let botclone = Arc::clone(&params_clone.bot);
let botlock = botclone.read().await;
let id = botlock.get_identity();
let id = Arc::clone(&id);
// botlog::trace(
// "ACQUIRING WRITE LOCK : ID",
// Some("Chat > send_botmsg".to_string()),
// Some(&params.msg),
// );
// Log::flush();
botlog::trace(
"ACQUIRING WRITE LOCK : ID",
"ACQUIRING READ LOCK : ID",
Some("Chat > send_botmsg".to_string()),
Some(&params.msg),
);
Log::flush();
{
let mut idlock = id.write().await; // <-- [ ] 03.24 - This is definitely locking it
}
// let idlock = id.write().await; // <-- [ ] 03.24 - This is definitely locking it
let idlock = id.read().await; // <-- [ ] 03.24 - seems to work
let a = idlock.getspecialuserroles(params.get_sender(), Some(Channel(msg.channel_login.clone()))).await;
botlog::trace(
"ACQUIRED WRITE LOCK : ID",
format!("GETSPECIALUSERROLES RESULT : {:?}",a).as_str(),
Some("Chat > send_botmsg".to_string()),
Some(&params.msg),
);
Log::flush();
// botlog::trace(
// "ACQUIRED WRITE LOCK : ID",
// Some("Chat > send_botmsg".to_string()),
// Some(&params.msg),
// );
// Log::flush();
botlog::trace(
"ACQUIRED READ LOCK : ID",
Some("Chat > send_botmsg".to_string()),
Some(&params.msg),
);
Log::flush();
self.send_botmsg(BotMsgType::SayInReplyTo(msg, outmsg) , params).await;