I have an application utilizing HangFire 1.6.17.
We have a recurring job that syncs data with an external system and uses the LastExecution Time to determine when to sync that since. We have the following code that runs at the beginning of a job to determine when the last execution finished:
var recurringJob = connection.GetRecurringJobs().FirstOrDefault(j => j.Id == recurringJobIdentifier);
if (recurringJob != null) return recurringJob.LastExecution;
It appears that the LastExecution value gets overwritten at the start of the process.
So for example, when the second process begins, it sets LastExecution = Now, then moments later when we read the LastExecution time, the value is seconds before so our sync period is a couple minutes.
What is the expected behavior of the LastExecution of a Recurring Job? Should that value be set at the beginning of a process, or after a process has completed?