-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(pubsub/pstest): replace global now atomic with struct field
It is counterintuitive to plumb through a time.Now replacement function only to have it refer to a global variable. Instead, make the Server timeNowFunc an atomic.Value field and add a now method accessor that loads the function value atomically and invokes it. Use that in tests, and also in the exported SetTimeNowFunc variable.
- Loading branch information
Showing
2 changed files
with
29 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters