@cryptotaxi247 / kubo / commits / f3a92617f

core/commands/pubsub.go: flush output before iterating over received messages

License: MIT Signed-off-by: keks <keks@cryposcope.co>

keks committed Nov 20, 2017 at 12:51 UTC f3a92617f80fe9d8bd2aa563c5126d3ee0ab9dc9
1 file changed +5
core/commands/pubsub.go
+5
@@ -5,6 +5,7 @@ import (
5 "encoding/binary"
6 "fmt"
7 "io"
8 + "net/http"
9 "sync"
10 "time"
11
@@ -109,6 +110,10 @@ This command outputs data in the following encodings:
110 }()
111 }
112
113 + if f, ok := res.(http.Flusher); ok {
114 + f.Flush()
115 + }
116 +
117 for {
118 msg, err := sub.Next(req.Context())
119 if err == io.EOF || err == context.Canceled {