We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e9726b5 commit f3fca60Copy full SHA for f3fca60
src/rlp-gateway/internal/web/read.go
@@ -45,7 +45,6 @@ func ReadHandler(
45
http.Error(w, err.Error(), http.StatusBadRequest)
46
return
47
}
48
-
49
flusher, ok := w.(http.Flusher)
50
if !ok {
51
errStreamingUnsupported.Write(w)
@@ -69,14 +68,10 @@ func ReadHandler(
69
68
)
70
71
data := make(chan *loggregator_v2.EnvelopeBatch)
72
- errs := make(chan error)
+ errs := make(chan error, 1)
73
74
go func() {
75
for {
76
- if isDone(ctx) {
77
- return
78
- }
79
80
batch, err := recv()
81
if err != nil {
82
errs <- err
@@ -87,7 +82,11 @@ func ReadHandler(
87
continue
88
83
89
84
90
- data <- batch
85
+ select {
86
+ case data <- batch:
+ case <-ctx.Done():
+ return
+ }
91
92
}()
93
0 commit comments