WIP: Basic Routine Functionality #40
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.
Blocks
Depends on
#5 [ENH] Routine functionality}
modulatingforce/forcebot_rs
#46 WIP: Child fn should be able to access BotAction Header
modulatingforce/forcebot_rs
#51 WIP: Routine Unresponsive due to Deadlock
modulatingforce/forcebot_rs
Reference: modulatingforce/forcebot_rs#40
Loading…
Reference in a new issue
No description provided.
Delete branch "routines-functionality"
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?
To address #5
Plan of Action :
countdown
BotCommand
that allows an Elevated Chatter to-a
add channels to target a routine messagestart
to start the routine with an inputString
, that sends a number of messages to the targeted channels with a countdown, until it reaches 0 when it sends a cute or funny messageReviewing the py
twitchio
documentation on routines - https://twitchio.dev/en/stable/exts/routines.htmlThe API wasn't too complicated . Among the functionality and attributes it included the following
completed_iterations
remaining_iterations
start_time
cancel()
change_interval()
restart()
stop_on_error
(bool
) whether to stop and cancel the routine on error . Defaults to Trueforce
(bool
) to cancel the currently running routine immediately and restart or if False, allow the routine to finish it's current iterationstart()
stop_on_error
(bool
) whether to stop and cancel the routine on error . Defaults to Truestop()
From Obsidian Vault note Brainstorm 0322
[x] Desired Functionality
The following might be a basic starter draft of what I want. Let's see what I come up with
statusdb
with it'sBotModule
- ⏩ As Mentioned in #5 , will be handled in separate future PRstatusdb
- ⏩ As Mentioned in #5 , will be handled in separate future PRstart()
the Routinestop()
the Routinestatusdb
, depending on where clones are separated - - ⏩ As Mentioned in #5 , will be handled in separate future PRHashMap
ontop of the newRoutine
objectsRoutine
hasRoutineAttr
BotAction
Routine
ManagementBotModule
isDisabled
, ensure that all relatedRoutine
arestop()
⏩ As Mentioned in #5 , will be handled in separate future PRThis is in essence a small demo of the problem scenario I'm facing when developing the
start()
methodhttps://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5c743e156cc110fc5a8c319991d44a21
Following may be the workaround - something similar I did with existing
runner
andlistener_main_prvmsg
forBotInstance
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0fc9e09bc9d4d53ee492814a2914b4e8
Addressing the following separate issue in #47
@ -573,0 +919,4 @@
// while inroutine.read().await.remaining_iterations.unwrap_or(0) > 1 {
// execution body
inroutine.read().await.loopbody().await;
During Live Tests , issuing
BotCommand
appears to setup & begin tostart()
the routine , but never makes it to this point when the routine is started .Strangely, the traces in this same
tokio::spawn
are being logged? But nothing is being logged within theloopbody()
or after this lineCreated PR #47 to address this issue
Fixed . Refer to Resolution Notes - #47 (comment)
@ -0,0 +190,4 @@
params.clone()
).await;
newr.clone().write().await.join_handle.take().expect("Issue with join handle").await.unwrap();
Removing this statement completely seems to help resolve #47
Fixed . Refer to Resolution Notes - #47 (comment)
Consider adjusting
Routine.join_handle
@ -573,0 +622,4 @@
exec_body: bot_actions::actions_util::ExecBody,
// parent_params : Option<ExecBodyParams> ,
parent_params : ExecBodyParams ,
pub join_handle : Option<JoinHandle<()>> ,
Should we make this just
JoinHandle<()>
? This will requireRoutines
to always have this definedNo Keep with
Option<JoinHandle<()>>
. While constructing inRoutine::from()
, there is noJoinHandle
yet . AJoinHandle
is created at Task Spawn (which should be when it isStart
)[x] Routine Methods
validate_self_attr(self)
from()
- Constructorstart()
stop(&self) -> Result<String,String>
cancel(&self) -> Result<String,String>
restart
change_channel()
set_routine_attributes()
WIP: Routines Functionalityto WIP: Core Routines FunctionalityWIP: Core Routines Functionalityto WIP: Basic Routines FunctionalityWIP: Basic Routines Functionalityto WIP: Basic Routine FunctionalityThis is considered a block of the current PR
@ -0,0 +412,4 @@
if let BotAction::R(c) = &*guard {
println!("{:?}",c.read().await.channel);
}
println!("Critical code area end"); // <= 03.29 - ISSUE This is NOT printed
ISSUE . The defined Routine's Custom Execution Body is being reached (so the custom
fn
is being triggered as expected); However, I believe at L413 wherec.read().await.channel
, it never goes beyond that point within the same Customfn
bodyEven if the bot continues to be responsive (i.e., the
main
bot continues to run), the rest of the routine is not. I believe this is suggesting there's a lock with one of the objects we're introducing with this feature . In the above line, I believe the lock involvesExecBodyParam
'scurr_act
valueroutine
into it's own modulebot_action
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.