From fb460a424610cf6dbc4e51d6793687fc7f4f0035 Mon Sep 17 00:00:00 2001 From: iuwqyir Date: Thu, 22 May 2025 22:02:15 +0300 Subject: [PATCH] add timeout to abi request --- internal/common/abi.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/common/abi.go b/internal/common/abi.go index 77439ed..367d806 100644 --- a/internal/common/abi.go +++ b/internal/common/abi.go @@ -6,6 +6,7 @@ import ( "regexp" "strings" "sync" + "time" config "github.com/thirdweb-dev/indexer/configs" @@ -34,7 +35,12 @@ func GetABIForContractWithCache(chainId string, contract string, abiCache map[st func GetABIForContract(chainId string, contract string) (*abi.ABI, error) { url := fmt.Sprintf("%s/abi/%s/%s", config.Cfg.API.ThirdwebContractApi, chainId, contract) - resp, err := http.Get(url) + // Create a custom client with timeouts + client := &http.Client{ + Timeout: 10 * time.Second, + } + + resp, err := client.Get(url) if err != nil { return nil, fmt.Errorf("failed to get contract abi: %v", err) }