mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
internal/controld: bump default http client timeout
While at it, also converting them to global constants.
This commit is contained in:
committed by
Cuong Manh Le
parent
9fe36ae984
commit
a582195cec
@@ -32,6 +32,8 @@ const (
|
||||
logURLCom = apiURLCom + "/logs"
|
||||
logURLDev = apiURLDev + "/logs"
|
||||
InvalidConfigCode = 40402
|
||||
defaultTimeout = 20 * time.Second
|
||||
sendLogTimeout = 300 * time.Second
|
||||
)
|
||||
|
||||
// ResolverConfig represents Control D resolver data.
|
||||
@@ -135,7 +137,7 @@ func postUtilityAPI(version string, cdDev, lastUpdatedFailed bool, body io.Reade
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
transport := apiTransport(cdDev)
|
||||
client := http.Client{
|
||||
Timeout: 10 * time.Second,
|
||||
Timeout: defaultTimeout,
|
||||
Transport: transport,
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
@@ -176,7 +178,7 @@ func SendLogs(lr *LogsRequest, cdDev bool) error {
|
||||
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
transport := apiTransport(cdDev)
|
||||
client := http.Client{
|
||||
Timeout: 300 * time.Second,
|
||||
Timeout: sendLogTimeout,
|
||||
Transport: transport,
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
|
||||
Reference in New Issue
Block a user