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

WriteAPIImpl.Flush is unnecessarily complex #290

Open
pabigot opened this issue Dec 13, 2021 · 0 comments
Open

WriteAPIImpl.Flush is unnecessarily complex #290

pabigot opened this issue Dec 13, 2021 · 0 comments

Comments

@pabigot
Copy link
Contributor

pabigot commented Dec 13, 2021

WriteAPIImpl.Flush() appears to have an irrelevant bug, and to be overly complex for what it actually does, which does not include
flushing as implied by the documentation.

waitForFlushing() has two steps:

  1. Loop until the goroutine animating bufferProc() has acknowledged that bufferInfoCh has length zero. This is probably an error, and the length of bufferCh is intended to be checked.
  2. Loop until the goroutine animating writeProc() has acknowledged that writeCh has length zero.

A fundamental problem is that bufferCh, bufferInfoCh, and writeCh are all unbuffered channels: their length will never be anything but zero. So the only effect of waitForFlushing() is transient synchronizations with the bufferProc() and writeProc() goroutines. pabigot@b9b12c8 provides a simplified equivalent.

Since cleaning this up doesn't address the core problem of #289 I haven't submitted a PR, but I can do so if you wish.

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

Successfully merging a pull request may close this issue.

1 participant