Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements $cancel() method for ExtendedTask #4199

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shikokuchuo
Copy link
Member

Closes #4093.

Adds a $cancel() method to ExtendedTask, analogous to the python implementation.

This keeps it simple, and is straightforward as the do.call() in the code creates the task object anyway, and we just need to store it in a private field.

Previously I'd thought that the promise itself might have a $cancel method, but looking at javascript promises, this actually doesn't exist. It's also not natural to implement it that way, as promises::promise() takes functions as arguments, rather than the task object itself. We'd most likely need to rely on each as.promise() method to create this.

We could make cancellation extendable via a S3 generic for the task object for example, but as mirai is the only known implementation with cancellation capability thus far, we might defer this.

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.

ExtendedTasks: how to kill a task?
1 participant