Skip to content

Conversation

itzlambda
Copy link

fix: #627

@itzlambda
Copy link
Author

Noticed there where many changes which would cause merge conflict in #629, so have based this branch on top of it. After that PR is merged will rebase to main.


#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO: see if there are any better DS to handle this
let task_handles: TaskHandles = Arc::new(Mutex::new(Vec::<JoinHandle<()>>::new()));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to keep JoinHandle to all the tasks? iiuc these are only needed to call abort.

i was wondering if we can use TaskTracker instead to simplify and not needing to handle locks.

after cancellation tokens are properly setup we dont need to worry about manually calling abort to handles, and if even with cancellation token task take more than configured time to complete we are anyways going to shutdown (i.e. dropping runtime, which stops all the tasks) so calling abort on those rare cases shouldn't be required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant