8000 fix(sdk): no more ctx.Err() in queue polling (#3425) · ovh/cds@064bcc9 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 064bcc9

Browse files
fsaminrichardlt
authored andcommitted
fix(sdk): no more ctx.Err() in queue polling (#3425)
1 parent 5df9047 commit 064bcc9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sdk/cdsclient/http_sse.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ func (c *client) RequestSSEGet(ctx context.Context, path string, evCh chan<- SSE
7676
var currEvent *SSEvent
7777
var EOF bool
7878

79-
for !EOF {
80-
if ctx.Err() != nil {
81-
break
82-
}
79+
go func(stop *bool) {
80+
<-ctx.Done()
81+
*stop = true
82+
}(&EOF)
8383

84+
for !EOF {
8485
bs, err := br.ReadBytes('\n')
85-
8686
if err != nil && err != io.EOF {
8787
return err
8888
}

0 commit comments

Comments
 (0)
0