Method AcquireAsync
- Namespace
- MailFathom.Application.Jobs.Execution
- Assembly
- MailFathom.Application.dll
AcquireAsync(JobType, CancellationToken)
Waits until this process may run one more job of the given type.
public Task<IDisposable> AcquireAsync(JobType jobType, CancellationToken cancellationToken)
Parameters
jobTypeJobTypeThe type the job about to run belongs to.
cancellationTokenCancellationTokenAbandons the wait.
Returns
- Task<IDisposable>
The held capacity, which is given back when it is disposed.
Remarks
A cancelled wait gives back whatever it had already taken, so an abandoned acquisition leaves the ceilings exactly where it found them.
Exceptions
- ArgumentException
Thrown when
jobTypenames no declared job type.- OperationCanceledException
Thrown when
cancellationTokenis cancelled while waiting.