Hangfire Execution Time
I have a recurring job I've scheduled in Hangfire. If the app is not running and misses executions, then it might run multiple times when the app starts again.
How do I get access to the time that the job was supposed to have run for, but was missed?
It doesn't look like Hangfire provides any context for the job execution in the called method. Is this the kind of thing that has to be applied with a filter?
3 Replies
I don't think it's exposed by default, but you can access recurring job data directly through
JobStorage.Current.GetConnection().GetRecurringJobs()
. The List<RecurringJobDto>
it returns has last/next execution times, ids to enqueued jobs, and other info
doesn't exactly fit what you're asking for but you should be able to figure out what job executions were missed using itIts really odd that a library that schedules execution times can't supply the scheduled time at execution.
Thanks for the info @ded
yeah i always found it odd, most of my projects using hangfire end up with some convenience methods to load recurring job info lol