public async Task <bool> RemoveJob(JobKey jobKey, CancellationToken cancellationToken = default) { using var session = Store.OpenAsyncSession(); if (!await session.Advanced.ExistsAsync(jobKey.GetDatabaseId(), cancellationToken)) { return(false); } session.Delete(jobKey.GetDatabaseId()); await session.SaveChangesAsync(cancellationToken); return(true); }
public async Task <IJobDetail> RetrieveJob(JobKey jobKey, CancellationToken cancellationToken = default) { using var session = Store.OpenAsyncSession(); var job = await session.LoadAsync <Job>(jobKey.GetDatabaseId(), cancellationToken); return(job?.Deserialize()); }