search: disable retries for zoekt (#25449)

Currently our retry transport will always copy the request body. We plan
on contributing upstream usage of Request.GetBody to overcome this. For
now we disable to prevent possible OOMs on sourcegraph.com.
This commit is contained in:
Keegan Carruthers-Smith 2021-09-28 15:18:06 +02:00 committed by GitHub
parent 2f1b6505dd
commit 2c2391dbf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,20 @@ import (
"github.com/sourcegraph/sourcegraph/internal/httpcli"
)
var zoektHTTPClient, _ = httpcli.NewInternalClientFactory("zoekt_webserver").Client()
// We don't use the normal factory for internal requests because we disable
// retries. Currently our retry framework copies the full body on every
// request, this is prohibitive when zoekt generates a large query.
//
// Once our retry framework supports the use of Request.GetBody we can switch
// back to the normal internal request factory.
var zoektHTTPClient, _ = httpcli.NewFactory(
httpcli.NewMiddleware(
httpcli.ContextErrorMiddleware,
),
httpcli.NewMaxIdleConnsPerHostOpt(500),
httpcli.MeteredTransportOpt("zoekt_webserver"),
httpcli.TracedTransportOpt,
).Client()
// ZoektStreamFunc is a convenience function to create a stream receiver from a
// function.