Skip to content

Commit 99720bb

Browse files
authored
fix: handle the situation where the channel is closed (#304)
1 parent 420d521 commit 99720bb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

client/transport/sse.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,11 @@ func (c *SSE) SendRequest(
310310
case <-ctx.Done():
311311
deleteResponseChan()
312312
return nil, ctx.Err()
313-
case response := <-responseChan:
314-
return response, nil
313+
case response, ok := <-responseChan:
314+
if ok {
315+
return response, nil
316+
}
317+
return nil, fmt.Errorf("connection has been closed")
315318
}
316319
}
317320

0 commit comments

Comments
 (0)