We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a627a2f commit efbf5ffCopy full SHA for efbf5ff
client/transport/sse.go
@@ -110,13 +110,14 @@ func (c *SSE) Start(ctx context.Context) error {
110
go c.readSSE(resp.Body)
111
112
// Wait for the endpoint to be received
113
-
+ timeout := time.NewTimer(30 * time.Second)
114
+ defer timeout.Stop()
115
select {
116
case <-c.endpointChan:
117
// Endpoint received, proceed
118
case <-ctx.Done():
119
return fmt.Errorf("context cancelled while waiting for endpoint")
- case <-time.After(30 * time.Second): // Add a timeout
120
+ case <-timeout.C: // Add a timeout
121
cancel()
122
return fmt.Errorf("timeout waiting for endpoint")
123
}
0 commit comments