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

Why does the example_test fail when I run it locally? #80

Closed
sdlyingyong opened this issue Mar 30, 2022 · 2 comments
Closed

Why does the example_test fail when I run it locally? #80

sdlyingyong opened this issue Mar 30, 2022 · 2 comments

Comments

@sdlyingyong
Copy link

Can you give me some advice?
When I run the test, I find that it fails, the limit is not as expected (10ms)

My Environment:
GOVERSION=go1.16
GOHOSTARCH=amd64
GOHOSTOS=windows
GO111MODULE=on
GOARCH=amd64

Class library version:
go.uber.org/ratelimit v0.2.0

Specific implementation:
$ go test example_test.go
--- FAIL: Example (0.10s)
got:
1 10ms
2 10ms
3 15.903ms
4 4.097ms
5 11.3687ms
6 8.6313ms
7 10ms
8 12.3425ms
9 7.6575ms
want:
1 10ms
2 10ms
3 10ms
4 10ms
5 10ms
6 10ms
7 10ms
8 10ms
9 10ms
FAIL
FAIL command-line-arguments 0.150s
FAIL

@rabbbit
Copy link
Contributor

rabbbit commented Mar 31, 2022

I suspect this has to do with golang/go#44343 - there are a lot of comments relating to unreliable timers on windows there.

I did verify that this still works as expected on Darwin.

> go test example_test.go
ok      command-line-arguments  0.418s

rabbbit added a commit that referenced this issue Mar 31, 2022
rabbbit added a commit that referenced this issue Mar 31, 2022
* Add a comment on timers on windows

Based on #80
@sdlyingyong
Copy link
Author

This is very helpful to me. Thank you

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

No branches or pull requests

2 participants