-
Notifications
You must be signed in to change notification settings - Fork 89
Description
Pausing is just cancellation that can be recovered from. The behavior is very similar, pausing a job means requesting cancellation on the cancellation token. Any code using the cancellation token will throw an OperationCanceledException
as usual. The difference comes in the handling of the exception, instead of transitioning the job status to Cancelled
we check a boolean isRequestingPause
to either transition to the Cancelled
or Paused
state. This boolean will be set when someone is calling the Pause
method on the job.
Additionally, a Resume
method is required to transition from the Paused
state back to a Running
state. Note that this requires resetting internal state.