WIP: issue-routine-lock-idea2 #56

Draft
modulatingforce wants to merge 4 commits from issue-routine-lock-idea2 into issue-routine-lock
Showing only changes of commit d8c6ce3ee8 - Show all commits

View file

@ -145,7 +145,7 @@ impl Chat {
modulatingforce marked this conversation as resolved
Review

The following and patterns like this involving a loop and inner tokio::spawn are likely why we're seeing large memory usage with this change

Lines 142 to 145 in e73bd75
loop {
let r_ccc = r_cc.clone();
let chat_c = chat_ar.clone();
tokio::spawn(async move {

loop {
                let r_ccc = r_cc.clone();
                let chat_c = chat_ar.clone();
                tokio::spawn(async move {

Recommendation

  • if the above is really required, bound it please. For example with a for loop instead of a infinite loop
The following and patterns like this involving a `loop` and inner `tokio::spawn` are likely why we're seeing large memory usage with this change https://git.flake.sh/modulatingforce/forcebot_rs/src/commit/e73bd75de9ef38c1c0133dacea0711df63870441/src/core/chat.rs#L142-L145 ```rust loop { let r_ccc = r_cc.clone(); let chat_c = chat_ar.clone(); tokio::spawn(async move { ``` ### Recommendation - [x] if the above is really required, bound it please. For example with a `for` loop instead of a infinite `loop`
Review

The above helped the spawning and high memory usage

The above helped the spawning and high memory usage
// loop {
// Spawn x helper threads to process messages in the outqueue
for _ in 1..10 {
for _ in 1..5 {
dbg!("Chat queue Helper thread generated");
let r_ccc = r_cc.clone();