WIP: issue-routine-lock-idea2 #56

Draft
modulatingforce wants to merge 4 commits from issue-routine-lock-idea2 into issue-routine-lock

Initial Description

Possible fix for #51.

LULE my version that's way too dank

Includes enhancements to Chat for blocking calls

Branching off because changes are large, and may have introduced some problems here that need to be addressed as well

#51 (comment)

Plan of Action :

  • Implemented WAYTOODANK solution that includes enhancing Chat with an out queue that can be processed by blocking Chat.say methods
  • Will need to review other solutions first
  • Add a BotCommand that tests out Blocking Say vs Non Blocking Say
  • Unit tests?
  • Clippy & Comments cleanup
# Initial Description Possible fix for #51. LULE my version that's way too dank Includes enhancements to `Chat` for blocking calls Branching off because changes are large, and may have introduced some problems here that need to be addressed as well https://git.flake.sh/modulatingforce/forcebot_rs/pulls/51#issuecomment-1049 # Plan of Action : - [x] Implemented WAYTOODANK solution that includes enhancing `Chat` with an out queue that can be processed by blocking `Chat.say` methods - [ ] Will need to review other solutions first - [ ] Add a BotCommand that tests out Blocking Say vs Non Blocking Say - [ ] Unit tests? - [ ] Clippy & Comments cleanup
modulatingforce added 1 commit 2024-04-02 09:22:57 -04:00
modulatingforce self-assigned this 2024-04-02 09:25:40 -04:00
modulatingforce removed their assignment 2024-04-02 09:26:00 -04:00
modulatingforce self-assigned this 2024-04-02 09:26:04 -04:00
modulatingforce added this to the Forcebot Prototype 1.0 Push project 2024-04-02 09:26:06 -04:00
modulatingforce added the
Ownership
Individual Lead
label 2024-04-02 09:28:01 -04:00
modulatingforce added the
Kind/Bug Fix
label 2024-04-02 09:33:41 -04:00
modulatingforce reviewed 2024-04-02 10:24:17 -04:00
modulatingforce left a comment
Author
Owner
  • #todo Adj this infinite spawning pattern
- [x] #todo Adj this infinite spawning pattern
@ -54,0 +142,4 @@
loop {
let r_ccc = r_cc.clone();
let chat_c = chat_ar.clone();
tokio::spawn(async move {
Author
Owner

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`
Author
Owner

The above helped the spawning and high memory usage

The above helped the spawning and high memory usage
modulatingforce marked this conversation as resolved
modulatingforce added 2 commits 2024-04-02 23:56:54 -04:00
Author
Owner

The changes introduced here are definitely more than just the specific blocking scenario, but helps in other areas that may involve blocking and sending to chat

The changes introduced here are definitely more than just the specific blocking scenario, but helps in other areas that may involve blocking and sending to chat
Author
Owner

To Update, Memory usage after a 8 hour window while I slept had the bot running just under 20mb 🤤 (it started around 18-19mb)

Jesust that scared me when it jumped to 11GB before


I will admit though, I'm a little afraid of how this will scale will more elevated chatters, because all of this is stored in memory atm . Better would be DB solution, where I offload some of the larger data sets

To Update, Memory usage after a 8 hour window while I slept had the bot running just under 20mb 🤤 (it started around 18-19mb) Jesust that scared me when it jumped to 11GB before --- I will admit though, I'm a little afraid of how this will scale will more elevated chatters, because all of this is stored in memory atm . Better would be DB solution, where I offload some of the larger data sets
modulatingforce added 1 commit 2024-04-03 21:52:56 -04:00
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-routine-lock-idea2:issue-routine-lock-idea2
git checkout issue-routine-lock-idea2

Merge

Merge the changes and update on Forgejo.
git checkout issue-routine-lock
git merge --no-ff issue-routine-lock-idea2
git checkout issue-routine-lock
git merge --ff-only issue-routine-lock-idea2
git checkout issue-routine-lock-idea2
git rebase issue-routine-lock
git checkout issue-routine-lock
git merge --no-ff issue-routine-lock-idea2
git checkout issue-routine-lock
git merge --squash issue-routine-lock-idea2
git checkout issue-routine-lock
git merge --ff-only issue-routine-lock-idea2
git checkout issue-routine-lock
git merge issue-routine-lock-idea2
git push origin issue-routine-lock
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: modulatingforce/forcebot_rs#56
No description provided.