Skip to content

Commit f92cb3e

Browse files
committed
Do not trigger multiple offline status changes if many simultaneous requests are hitting a failing provider at the same time
1 parent 0092956 commit f92cb3e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

internal/http.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ func ProxyHTTP(ctx context.Context, endpoint *Endpoint, req *rpc.BatchRequest, t
4444
}
4545

4646
if err != nil {
47-
provider.SetStatus(false, err)
47+
// In a high traffic environment, the provider might be taken offline by another concurrent request
48+
if provider.online {
49+
provider.SetStatus(false, err)
50+
}
4851
continue
4952
}
5053

internal/ws.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,10 @@ func (proxy *WebSocketProxy) DialAnyProvider(e *Endpoint, timing *servertiming.H
306306
}
307307

308308
if err != nil {
309-
p.SetStatus(false, err)
309+
// In a high traffic environment, the provider might be taken offline by another concurrent request
310+
if p.online {
311+
p.SetStatus(false, err)
312+
}
310313
continue
311314
}
312315

0 commit comments

Comments
 (0)