JadKHaddad/Rocust

unpredictable task increments when user attempts selfstop

Closed this issue · 3 comments

it's up to tokio to decide wether the add_task function or the cancellation_token will be executed first, thus leading to unpredictable increments of tasks if user attempts selfstop (this is undefined behavior)

move "add_task" to

 select! {
...
_ = task_call_and_sleep => {
//here
...
}

check