vbauerster / mpb

multi progress bar for Go cli applications
The Unlicense
2.29k stars 123 forks source link

Panic when calling bar.DecoratorEwmaUpdate inside goroutine #117

Closed DeltaLaboratory closed 1 year ago

DeltaLaboratory commented 1 year ago

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 commented 1 year ago

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

DeltaLaboratory commented 1 year ago

The patch fixed the problem. Thank you!