Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
add error handling for sentinel cid lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
AmeanAsad committed Jul 5, 2023
1 parent 44d5802 commit c20f01c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (p *pool) fetchSentinelCid(node string) error {
}
trialTimeout, cancel := context.WithTimeout(context.Background(), 30*time.Second)
reqUrl := fmt.Sprintf(sentinelCidReqTemplate, sc)
goLogger.Debugw("Fetching Sentinel CID: ", sc, " from: ", node)
goLogger.Debugw("fetching sentinel cid: ", reqUrl, " from: ", node)
err = p.fetchResourceAndUpdate(trialTimeout, node, reqUrl, 0, p.mirrorValidator)
cancel()
return err
Expand Down
4 changes: 4 additions & 0 deletions tieredhashing/tiered_hashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ func (t *TieredHashing) GetPerf() map[string]*NodePerf {

func (t *TieredHashing) GetSentinelCid(ip string) (string, error) {
if node, ok := t.nodes[ip]; ok {
if len(node.SentinelCid) > 0 {
return node.SentinelCid, nil
} else {
return "", fmt.Errorf("sentinel cid doesn't exist for node: %s ", ip)
}

} else {
return "", fmt.Errorf("node with IP: %s is not in Caboose pool ", ip)
Expand Down

0 comments on commit c20f01c

Please sign in to comment.