add retry configs

This commit is contained in:
colinlyguo
2023-08-02 02:32:05 +08:00
parent f86cbb2bcb
commit 0466e2d201
3 changed files with 9 additions and 3 deletions

View File

@@ -24,6 +24,8 @@ func NewCoordinatorClient(cfg *config.CoordinatorConfig) (*CoordinatorClient, er
client := resty.New().
SetTimeout(time.Duration(cfg.Timeout) * time.Second).
SetRetryCount(cfg.RetryCount).
SetRetryWaitTime(time.Duration(cfg.RetryWaitTime) * time.Second).
SetBaseURL(cfg.BaseURL)
return &CoordinatorClient{

View File

@@ -8,7 +8,9 @@
},
"coordinator": {
"base_url": "https://coordinator/v1",
"timeout": 30
"timeout": 30,
"retry_count": 3,
"retry_wait_time": 10
},
"confirmations": "0x1"
}

View File

@@ -33,8 +33,10 @@ type ProverCoreConfig struct {
// CoordinatorConfig represents the configuration for the Coordinator client.
type CoordinatorConfig struct {
Timeout int `json:"timeout"`
BaseURL string `json:"base_url"`
Timeout int `json:"timeout"`
BaseURL string `json:"base_url"`
RetryCount int `json:"retry_count"`
RetryWaitTime int `json:"retry_wait_time"`
}
// NewConfig returns a new instance of Config.