-
Notifications
You must be signed in to change notification settings - Fork 124
Using time.Ticker for running stoppable listener. Fix edge case where flush happens after the listener is stopped. #21
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
Conversation
… flush happens after the listener is stopped.
progress.go
Outdated
| default: | ||
| time.Sleep(p.RefreshInterval) | ||
|
|
||
| go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported function .Listen() changes its behavior from doing the listen loop to spawning a goroutine and exiting without waiting for the end of the processing. Which is a breaking change, IMHO and should probably be avoided.
|
@henvic works for me from the functional point of view. |
|
@mgurov, what about now? I have done the same changes on uilive as well. |
|
@henvic LGTM now. My comments are addressed. Thank you! |
|
Hey @mgurov, If you run the tests repeatedly (just do I have tried adding even a |
|
@henvic two things. First, if you run Second, as far as I can see there is no strict guarantee that your |
|
@mgurov, Actually note that this might happen even for just one test. I said to run it repeatedly because it'd be easier for the issue to be replicated. |
|
I think with these last changes the synchronization issue is gone. |
91304f9 to
e3db2fd
Compare
|
👍 for merge |
|
@xorpaul, if you are blocked while these fixes doesn't make mainstream you can temporarily use my fork (or better, do a fork of this repo yourself and do what I did in order for you to keep track you're not using the official version). It is set with the fix-race-condition-on-stop-henvic branch as the default one and the uilive dependency there is pointing to a uilive with these fixes as well, so you can just 'go get' and use it (or do the same for uilive). Just need to replace gosuri with henvic on your code. |
|
@henvic Yeah, thanks for the suggestion, but I am already using your fork 😄 |
|
great! thanks so much |
This should close #18 and #20.
@mgurov, can you take a look at the changes I have made on top of your code (which I actually rebased), please?
gosuri/uilive#7 is also needed.