Skip to content

Commit fb460a4

Browse files
committed
add timeout to abi request
1 parent 77ebcc3 commit fb460a4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/common/abi.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"regexp"
77
"strings"
88
"sync"
9+
"time"
910

1011
config "github.com/thirdweb-dev/indexer/configs"
1112

@@ -34,7 +35,12 @@ func GetABIForContractWithCache(chainId string, contract string, abiCache map[st
3435
func GetABIForContract(chainId string, contract string) (*abi.ABI, error) {
3536
url := fmt.Sprintf("%s/abi/%s/%s", config.Cfg.API.ThirdwebContractApi, chainId, contract)
3637

37-
resp, err := http.Get(url)
38+
// Create a custom client with timeouts
39+
client := &http.Client{
40+
Timeout: 10 * time.Second,
41+
}
42+
43+
resp, err := client.Get(url)
3844
if err != nil {
3945
return nil, fmt.Errorf("failed to get contract abi: %v", err)
4046
}

0 commit comments

Comments
 (0)