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

Panic when calling bar.DecoratorEwmaUpdate inside goroutine #117

Closed
DeltaLaboratory opened this issue Sep 18, 2022 · 2 comments
Closed

Panic when calling bar.DecoratorEwmaUpdate inside goroutine #117

DeltaLaboratory opened this issue Sep 18, 2022 · 2 comments

Comments

@DeltaLaboratory
Copy link

DeltaLaboratory commented Sep 18, 2022

When i calling bar.DecoratorEwmaUpdate after calling bar.Increment() inside goroutine, it panics.

I am using go1.19.1, windows/amd64.

There is some example code that seems cause panic...

https://go.dev/play/p/2oSrMdlHcEF

vbauerster added a commit that referenced this issue Sep 19, 2022
@vbauerster
Copy link
Owner

I've updated api to fix this. You need to call bar.EwmaIncrement(time.Since(goRoutineStartTime)) instead.
https://go.dev/play/p/pYIHUmWzo5O

@DeltaLaboratory
Copy link
Author

The patch fixed the problem.
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