-
Notifications
You must be signed in to change notification settings - Fork 881
refactor(coderd/provisionerdserver): use quartz.Clock instead of TimeNowFn #15642
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
Conversation
func (s *server) timeNow(tags ...string) time.Time { | ||
return dbtime.Time(s.Clock.Now(tags...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍
if options.Clock == nil { | ||
options.Clock = quartz.NewReal() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Even if api.Clock
is nil
for some reason this should keep us covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hell yeah
Relates to #15082 (comment) (and #15594)
For testing the autostart change in the linked PR we need to have control over time in the
provisionerdserver
. Currently that is possible with aTimeNowFn
but this wasn't hooked up tocoderd
. This PR replacesTimeNowFn
inprovisionerdserver
withquartz.Clock
as well as passescoderd
'sClock
toprovisionerdserver
.