Skip to content

Commit

Permalink
use response writer's Write instead of io.Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
kasey committed Oct 16, 2024
1 parent 3fa6d3b commit 71fb9d1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion beacon-chain/rpc/eth/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@ func (es *eventStreamer) outboxWriteLoop(ctx context.Context, cancel context.Can
func (es *eventStreamer) writeOutbox(ctx context.Context, w StreamingResponseWriter, first lazyReader) error {
needKeepAlive := true
if first != nil {
if _, err := io.Copy(w, first()); err != nil {
b, err := io.ReadAll(first())
if err != nil {
return err
}
_, err = w.Write(b)
if err != nil {
return err
}
needKeepAlive = false
Expand Down

0 comments on commit 71fb9d1

Please sign in to comment.