mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Merge pull request #392 from maticnetwork/v0.2.16-candidate
v0.2.16 state sync fix
This commit is contained in:
commit
f083705e00
1 changed files with 11 additions and 1 deletions
|
|
@ -99,11 +99,22 @@ func (h *HeimdallClient) FetchWithRetry(rawPath string, rawQuery string) (*Respo
|
||||||
u.Path = rawPath
|
u.Path = rawPath
|
||||||
u.RawQuery = rawQuery
|
u.RawQuery = rawQuery
|
||||||
|
|
||||||
|
// attempt counter
|
||||||
|
attempt := 1
|
||||||
|
|
||||||
|
// request data once
|
||||||
|
res, err := h.internalFetch(u)
|
||||||
|
if err == nil && res != nil {
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
// create a new ticker for retrying the request
|
// create a new ticker for retrying the request
|
||||||
ticker := time.NewTicker(5 * time.Second)
|
ticker := time.NewTicker(5 * time.Second)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
log.Info("Retrying again in 5 seconds to fetch data from Heimdall", "path", u.Path, "attempt", attempt)
|
||||||
|
attempt++
|
||||||
select {
|
select {
|
||||||
case <-h.closeCh:
|
case <-h.closeCh:
|
||||||
log.Debug("Shutdown detected, terminating request")
|
log.Debug("Shutdown detected, terminating request")
|
||||||
|
|
@ -113,7 +124,6 @@ func (h *HeimdallClient) FetchWithRetry(rawPath string, rawQuery string) (*Respo
|
||||||
if err == nil && res != nil {
|
if err == nil && res != nil {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
log.Info("Retrying again in 5 seconds to fetch data from Heimdall", "path", u.Path)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue