HangfireIO / HangfireIO/Hangfire

Scheduled Job has Started Sooner than Defined Time

Open
#2,540 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
10.1k
Forks
1.8k
Avg merge
1h 19m
Merged PRs (30d)
1

Description

I’ve observed that a job scheduled with BackgroundJob.Schedule has started before its defined UTC execution time.

In my case:

Scheduled time: 2025-08-13T09:51:48.509664Z

Actual execution start (from logs): 2025-08-13T09:51:48.375Z

Difference: ~134 milliseconds early

the compare code:
if (project.ExpirationDate >= DateTime.UtcNow)

schedule code:

   _backgroundJobClient.Schedule<IProjectExpirationService>(x => x.CheckAndExpireProjectAsync(
            notification.DomainEvent.ProjectId, CancellationToken.None), notification.DomainEvent.ExpirationDate);

ExpirationDate is UTC DateTime

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the BackgroundJob.Schedule call and the shown DateTime.UtcNow comparison, then reproduce the reported UTC timing difference using the timestamps from the issue. Trace the scheduling and execution path to determine whether the early start is expected timing behavior or a defect; done means establishing the cause and a focused change or documented conclusion.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.