Fixing the proxy timeout settings which were not passed to the client and and graphql server.

This commit is contained in:
2024-08-20 11:38:40 +01:00
parent 8b8a389cc3
commit 9150b25227
3 changed files with 86 additions and 12 deletions
+2 -9
View File
@@ -17,14 +17,6 @@ import (
"github.com/valyala/fasthttp"
)
var (
httpClient *fasthttp.Client
)
func init() {
httpClient = createFasthttpClient(30) // Assuming a default timeout of 30 seconds
}
func createFasthttpClient(timeout int) *fasthttp.Client {
return &fasthttp.Client{
Name: "graphql_proxy",
@@ -40,6 +32,7 @@ func createFasthttpClient(timeout int) *fasthttp.Client {
DisableHeaderNamesNormalizing: true,
}
}
func proxyTheRequest(c *fiber.Ctx, currentEndpoint string) error {
if !checkAllowedURLs(c) {
cfg.Logger.Error(&libpack_logger.LogMessage{
@@ -64,7 +57,7 @@ func proxyTheRequest(c *fiber.Ctx, currentEndpoint string) error {
err = retry.Do(
func() error {
return proxy.DoRedirects(c, proxyURL, 3, httpClient)
return proxy.DoRedirects(c, proxyURL, 3, cfg.Client.FastProxyClient)
},
retry.OnRetry(func(n uint, err error) {
cfg.Logger.Warning(&libpack_logger.LogMessage{