fix: script leak and shut down and remove per-message goroutine#69
fix: script leak and shut down and remove per-message goroutine#69swarna1101 merged 2 commits intomainfrom
Conversation
📝 WalkthroughWalkthroughRefactors CLI clients to centralize per-worker error aggregation and cancellation, simplifies subscribe receive loops, validates input flags, and updates file-writing to a cancellable writer with header and filename parameters. No public API additions. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@grpc_p2p_client/shared/utils.go`:
- Around line 246-250: Move the error check so you verify the result of
writer.WriteString(data + "\n") before calling writer.Flush(), and also handle
the error returned by writer.Flush(); specifically, after calling
writer.WriteString in the current function (where writer.WriteString and
writer.Flush are used) check if err != nil and log/return immediately, then call
writer.Flush() and check its error too (log/return if non-nil). Reference the
existing symbols writer.WriteString and writer.Flush to locate the code to
change.
🧹 Nitpick comments (1)
grpc_p2p_client/shared/utils.go (1)
247-247: Consider batching flushes for better performance.Calling
Flush()after every write negates the benefits of buffered I/O. For high-throughput scenarios, this could be a performance bottleneck. Consider flushing periodically (e.g., every N writes or on a timer) or relying on the deferredFlush()at function exit.
Summary by CodeRabbit
Bug Fixes
Improvements
Documentation