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

refactor: eliminate usages of time.Sleep in test code #2182

Merged
merged 2 commits into from
Jul 6, 2023
Merged

Conversation

cgrinds
Copy link
Collaborator

@cgrinds cgrinds commented Jul 5, 2023

No description provided.

Hardikl
Hardikl previously approved these changes Jul 6, 2023
@@ -169,8 +169,9 @@ func SetNameservice(nsDB, nsSource, nisDomain string, instance *matrix.Instance)
}

// IsTimestampOlderThanDuration - timestamp units are micro seconds
func IsTimestampOlderThanDuration(timestamp float64, duration time.Duration) bool {
return time.Since(time.UnixMicro(int64(timestamp))) > duration
// The `begin` argument lets us virtualize time without requiring sleeps in test code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: may be name of var would be other than begin as it seems first time, but we actually are using last time - first time.

rahulguptajss
rahulguptajss previously approved these changes Jul 6, 2023
@cgrinds cgrinds dismissed stale reviews from rahulguptajss and Hardikl via 6030a65 July 6, 2023 11:58
@cgrinds cgrinds merged commit b67187f into main Jul 6, 2023
@cgrinds cgrinds deleted the cbg-no-sleep branch July 6, 2023 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants