coravel
coravel copied to clipboard
Is there a way to cancel an invocable (not queued)?
I can see that when implementing ICancellableTask from the invocable, we get a Token. IScheduler exposes "CancelAllCancellableTasks", is there a way I can cancel a task specifically? (by name?).
The queue invocables allow us to deconstruct the tuple, is there something similar for none queues?
Thankyou for the awesome project!
No, all invocables that are registered via the scheduler are all tied to the same cancellation token, which is triggered upon app shutdown.
What's the scenario you're looking to do?
You could use C# CancellationTokenSource to do this.
Off the top of my head (this may not compile or make 100% sense), something like:
using var source = new CancellationTokenSource();
try {
source.CancelAfter(TimeSpan.FromSeconds(30));
// Do your stuff.
}
catch (OperationCanceledException)
{
// Timeout occurred.
}