Skip to content

Commit

Permalink
always call Flush(), to stop the sending routine
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Sep 4, 2024
1 parent 243fc7c commit dae3721
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions front/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ func callAndCache(r *request, w text.Writer, args []string, f func(text.Writer,
for {
chunk, ok := <-c
if !ok {
if send {
if err := w.Flush(); err != nil {
r.Log.Warn("Failed to send response", "error", err)
}
// always call Flush()
if err := w.Flush(); err != nil && send {
r.Log.Warn("Failed to send response", "error", err)
}

break
Expand Down

0 comments on commit dae3721

Please sign in to comment.