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.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
|
||||
ticker := time.NewTicker(5 * time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
log.Info("Retrying again in 5 seconds to fetch data from Heimdall", "path", u.Path, "attempt", attempt)
|
||||
attempt++
|
||||
select {
|
||||
case <-h.closeCh:
|
||||
log.Debug("Shutdown detected, terminating request")
|
||||
|
|
@ -113,7 +124,6 @@ func (h *HeimdallClient) FetchWithRetry(rawPath string, rawQuery string) (*Respo
|
|||
if err == nil && 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