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

fix: flush BufWriter #22

Merged
merged 3 commits into from
Nov 7, 2024
Merged

fix: flush BufWriter #22

merged 3 commits into from
Nov 7, 2024

Conversation

sgbalogh
Copy link
Member

@sgbalogh sgbalogh commented Nov 7, 2024

This wasn't happening before, so stdout / file was never getting the content of records.

From tokio docs:

When the BufWriter is dropped, the contents of its buffer will be discarded. Creating multiple instances of a BufWriter on the same stream can cause data loss. If you need to write out the contents of its buffer, you must manually call flush before the writer is dropped.

@sgbalogh sgbalogh requested a review from a team as a code owner November 7, 2024 21:45
Comment on lines 545 to +548
}
if let Some(ref mut writer) = writer {
writer.flush().await.expect("writer flush");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it not write anything to stdout? and if you ctrl + c, does it not write anything?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was not writing anything to stdout earlier, even if ctrl-c'ing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not sure then what i was seeing when i was testing this. thanks for finding and fixing this!

Copy link
Member

@shikhar shikhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks! I ran into this and meant to dig

@sgbalogh sgbalogh merged commit bdd94c1 into main Nov 7, 2024
2 checks passed
@sgbalogh sgbalogh deleted the flush-writer branch November 7, 2024 21:52
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 this pull request may close these issues.

3 participants