stop retrying signal connection if the request context is closed (#1820)

This commit is contained in:
Paul Wells
2023-06-22 07:09:34 -07:00
committed by GitHub
parent 00558dee5c
commit c38791ff0a
+4
View File
@@ -199,6 +199,10 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var cr connectionResult
var initialResponse *livekit.SignalResponse
for i := 0; i < 3; i++ {
if err = r.Context().Err(); err != nil {
break
}
connectionTimeout := 3 * time.Second * time.Duration(i+1)
ctx := utils.ContextWithAttempt(r.Context(), i)
cr, initialResponse, err = s.startConnection(ctx, roomName, pi, connectionTimeout)