Fix bug with getting a stale JobQueues query result that resulted in the

same job being executed multiple times by different worker threads (e.g.
consider a Hangfire job then sending out the same email multiple times).
This commit is contained in:
Joerg Kiegeland
2017-07-08 22:29:45 +10:00
parent b0c3b5e2ed
commit 64f4927e1b
@@ -62,6 +62,7 @@ namespace Hangfire.Raven.JobQueues
foreach (var job in repository.Query<Hangfire_JobQueues.Mapping, Hangfire_JobQueues>()
.Where(fetchCondition)
.Where(job => job.Queue == queue)
.Customize(x => x.WaitForNonStaleResultsAsOfNow())
.OfType<JobQueue>())
{
job.FetchedAt = DateTime.UtcNow;