Routine.Start() to run it's execution body for given duration #47
No reviewers
Labels
No labels
Automated
Backlog
Post_Prototype_1.0
Bot_Code
Core
Bot_Code
Custom
CI/CD
Complexity
Advanced
Complexity
Basic
Complexity
Expert
Complexity
Intermediate
Kind/Breaking
Kind/Bug
Kind/Bug Fix
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Nix
Ownership
Collab
Ownership
Collab with Leads
Ownership
Individual Lead
Ownership
In-Review
Ownership
Needs Owner > May Delegate
Ownership
Workshop with Leads
Phase 1.0
Requirements > Drafting
Phase 1.0
Requirements > Researching
Phase 1.0
Requirements > Review & Planning
Phase 2.0
Design > Research & Analysis
Phase 3.0
Coding > Implementation
Phase 4.0
QA > Unit Testing & Design
Phase 5.0
Resolution > Completed
Phase 5.0
Resolution > Review for Completion
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
modulatingforce/forcebot_rs!47
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "routine-start-issue"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Raised from
RoutinesFunctionality PR being introduced in #40Routine.Start()to run it's execution body for given duration🔥High Priority as this is a blocker of the current
RoutinefunctionalityFunctional Use Case :
As a Custom Module Developer, I create a new Custom Module
In the module, Related to a
RoutineobjectRoutineby callingfrom()and passingRoutineAttrlikeRunOnce. I also pass the async fnstart()theRoutineIn the module, Related to a
BotCommandobjectBotCommandthat defines the above for theRoutineobjectTo test , I can go Twitch Chat and issue the
BotCommand. This should successfully create & start the routineSmol Working Demo -
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0fc9e09bc9d4d53ee492814a2914b4e8
The above Working Sample Code Demonstrates :
Routineobject withfrom()andstart()tokio::spawnis executed as definedNOTE : There may be a few differences between working and code problem bot code
ISSUE
During Runtime at
Botcommandrun , there seems to be issues within thetokio:spawnreaching a point involving the followingRefer to : #40 (comment)
The above line calls the defined async routine execution body
Logs & twitch observations :
Logs do show trace statements just before the above line , and within the
tokio:spawn. However, logs also seem to suggest sometimes some of these log traces intokio:spawnbefore that point are triggered, and sometimes they are nottokio:spawnmight be ending prematurely before allowing the above line to trigger?There is no critical
writelocking issue . The Bot continues to be responsive in twitchPlan of Action :
~Will collaborate with others (tori uwu) on this current branch for possible working solutionsWorst case: don't reinvent the wheel - look how others implement this probably common object in rustFor the related line in code, refer to
#40 (comment)
Possible Solution : Code Recommendation at Custom Module
Remove the following line from the custom module .
newr.clone().write().await.join_handle.take().expect("Issue with join handle").await.unwrap();The above appears to be trying to handle & then
take()theJoinHandleatRoutineobject .JoinHandleRemoving the above line ensures that as long as the
BotInstanceis continuing to run, theRoutine's spawned tasks will run until completed or abortedResolution Notes
Resolution Type : Code Change - Bot_Custom Code
Related Core Fix Commits :
modulatingforce/forcebot_rs@be00fe1d7efixes the issueSOP Recommendations :
JoinHandleis beingawaitor handled . In the current case, removing a potentially unnecessary call totake()helped address the issue .Learning Experiences :
take()atJoinHandlemay be (by design) Deallocating theJoinHandle, therefore acting to it similarly to anabort()CustomCode to try to handle some borrowing related issues or test these out. We've determinedtake()is not requiredabortalso . If required, the same Core Fix Commit has comments on workingabortofJoinHandleat Custom Code levelWIP: Routine.Start() to run it's execution body for given durationto Routine.Start() to run it's execution body for given durationPull request closed