-
Notifications
You must be signed in to change notification settings - Fork 341
BufWriter not flushed #586
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
Comments
@mtthw-meyer Thanks for reporting! Before we proceed, could I ask you to upload the code to github or put it in a gist? I'd rather not unzip files locally. Thanks! |
I was just about to file an issue about the documentation being wrong. For now (until async destructors are possible) probably the best thing would be to change the documentation, which is currently inaccurate. The docs state:
This is true of std's BufWriter type, but not of async-std's type. async-std's type does nothing on Drop, and you have to explicitly call flush to flush it. This is not surprising: there's no way to yield from async operations in destructors, so it would have to spawn a new task or block this thread in order to implement this behavior. The documentation should be changed to clarify that this type does nothing on Drop and users must call flush. For now. The docs also contain this line:
This is definitely a typo and should instead refer to |
This was partially fixed in async-rs#586, but there's another sentence later that makes the same claim.
If you run the attached code, connect a client, and then terminate it the time stamp is not flushed to disk (as expected?). Adding an explicit call to flush() fixed it but seems like it should not be necessary.
https://gist.github.com/mtthw-meyer/34d85197e01d686dacca5cf1cd6b28b3
The text was updated successfully, but these errors were encountered: