Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9bb17a68d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| parseErr := jsonParseThenAppend(r, func(e *vfsEvent) error { | ||
| select { | ||
| case events <- e: | ||
| return nil | ||
| case err := <-writeErrCh: |
There was a problem hiding this comment.
Stop parsing immediately when writer errors
The select can still choose events <- e even when writeErrCh is already readable, because Go selects randomly among ready cases. If the writer goroutine fails, the parser may enqueue up to the remaining buffer capacity (1024) of additional events before it eventually notices the error, and those events will be dropped because the writer has exited. That creates silent data loss in the exact scenario the error reporting is meant to handle. Consider prioritizing the error path (e.g., non-blocking check of writeErrCh before enqueue) so parsing halts as soon as the writer fails.
Useful? React with 👍 / 👎.
|
Wrong |
Motivation
Description
eventschannel and a writer goroutine that consumes events and callsappender.AppendRowincmd_vfs_raw.go.writeErrChto propagate writer errors back to the parser and adonechannel to coordinate shutdown.jsonParseThenAppendcallback to send parsed*vfsEventinto theeventschannel and handle early writer errors.events, waiting for the writer to finish, and returning any parse or write errors.Testing
Codex Task