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…
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
Routines
Functionality 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
Routine
functionalityFunctional Use Case :
As a Custom Module Developer, I create a new Custom Module
In the module, Related to a
Routine
objectRoutine
by callingfrom()
and passingRoutineAttr
likeRunOnce
. I also pass the async fnstart()
theRoutine
In the module, Related to a
BotCommand
objectBotCommand
that defines the above for theRoutine
objectTo 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 :
Routine
object withfrom()
andstart()
tokio::spawn
is executed as definedNOTE : There may be a few differences between working and code problem bot code
ISSUE
During Runtime at
Botcommand
run , there seems to be issues within thetokio:spawn
reaching 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:spawn
before that point are triggered, and sometimes they are nottokio:spawn
might be ending prematurely before allowing the above line to trigger?There is no critical
write
locking 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()
theJoinHandle
atRoutine
object .JoinHandle
Removing the above line ensures that as long as the
BotInstance
is 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 :
be00fe1d7e
fixes the issueSOP Recommendations :
JoinHandle
is beingawait
or handled . In the current case, removing a potentially unnecessary call totake()
helped address the issue .Learning Experiences :
take()
atJoinHandle
may be (by design) Deallocating theJoinHandle
, therefore acting to it similarly to anabort()
Custom
Code to try to handle some borrowing related issues or test these out. We've determinedtake()
is not requiredabort
also . If required, the same Core Fix Commit has comments on workingabort
ofJoinHandle
at 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