Skip to content

Commit

Permalink
bubble up errors when fetching proposer duties fails (reset client re…
Browse files Browse the repository at this point in the history
…adiness)
  • Loading branch information
pk910 committed Sep 13, 2023
1 parent 4634360 commit b6f0008
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions indexer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ func (client *IndexerClient) runIndexerClient() error {
currentEpoch := utils.TimeToEpoch(time.Now())
if currentEpoch > client.lastEpochStats {
// ensure latest epoch stats are loaded for chain of this client
client.ensureEpochStats(uint64(currentEpoch), client.lastHeadRoot)
err := client.ensureEpochStats(uint64(currentEpoch), client.lastHeadRoot)
if err != nil {
client.isConnected = false
return err
}
}
}
}
Expand Down Expand Up @@ -344,7 +348,10 @@ func (client *IndexerClient) prefillCache(finalizedSlot uint64, latestHeader *rp
}
currentEpoch := utils.EpochOfSlot(currentBlock.Slot)
for epoch := firstEpoch; epoch <= currentEpoch; epoch++ {
client.ensureEpochStats(epoch, currentBlock.Root)
err := client.ensureEpochStats(epoch, currentBlock.Root)
if err != nil {
return err
}
}

return nil
Expand Down
1 change: 1 addition & 0 deletions rpc/beaconapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (bc *BeaconClient) getJson(requrl string, returnValue interface{}) error {
return errNotFound
}
data, _ := io.ReadAll(resp.Body)
logger.WithField("client", bc.name).Debugf("RPC Error %v: %v", resp.StatusCode, data)
return fmt.Errorf("url: %v, error-response: %s", logurl, data)
}

Expand Down

0 comments on commit b6f0008

Please sign in to comment.