Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeProvider isn't used everywhere #169

Closed
nulltoken opened this issue Jan 19, 2025 · 5 comments · Fixed by #178
Closed

TimeProvider isn't used everywhere #169

nulltoken opened this issue Jan 19, 2025 · 5 comments · Fixed by #178
Assignees

Comments

@nulltoken
Copy link
Collaborator

nulltoken commented Jan 19, 2025

Describe the bug
There are at least three places where TimeProvider isn't used and where DateTimeOffset is preferred

  • ExecutionProgress
  • JobState
  • JobWorker

Should we align everything to TimeProvider?

@linkdotnet
Copy link
Member

You mean in our public API? For example triggering instant jobs?

@linkdotnet
Copy link
Member

If so - I don't think TimeProvider would add value here. There is already an interface if mocking / stubbing is the issue. So I am not sure what the user would gain

@nulltoken
Copy link
Collaborator Author

Lots of places relies on the TimeProvider, which is handy from the testing standpoint.

However, following places don't.

Image

Image

Image

@nulltoken
Copy link
Collaborator Author

Those DatetimeOffset.Now won't play nice with FakeTimer.Advance()

@linkdotnet
Copy link
Member

Okay that is fair! I assume it should be fairly straightforward to pass in a TimeProvider via the ctor.

@nulltoken nulltoken self-assigned this Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants