Get the planned time a recurring job should have been created?

I have found several similar questions in SO and here, but none of them were actually answered.

I am able to access the instant the job was created by Hangfire from the PerformContext through context.BackgroundJob?.CreatedAt.

The issue is that during heavy loads, the job ends up getting delayed and is created much after it was ideally planned to be created. This introduces an unpredictable variable in my code that is very hard to handle.

For example. The following recurring job is scheduled:

  • CRON: 0 7 1 * *
  • LastExecution: 2023-12-01T07:10:59.5173785Z

In my use case, I would be able to build a workaround if I had the actual planned execution time, but since I don’t have access to that information, I end up having to build hacky workarounds to estimate the execution time.

In my specific case, I subtract 10 minutes from the execution time and hope the job ran in this time frame. Today, this failed, since the job was delayed 10m and 59s.