Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
jordipainan committed Apr 11, 2024
1 parent 293335f commit ca6ac27
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions census3/census3.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
const (
// maxRetries is the maximum number of retries for a request.
maxRetries = 3
// cooldown is the time to wait between retries.
cooldown = time.Second * 2
// retryTime is the time to wait between retries.
retryTime = time.Second * 2
)

// Client wraps a client for the Census3 API and other revelant data.
Expand Down Expand Up @@ -51,7 +51,7 @@ func requestWithRetry[T any](fn reqFunc[T]) (T, error) {
for i := 0; i < maxRetries; i++ {
result, err := fn()
if err != nil {
time.Sleep(cooldown)
time.Sleep(retryTime)
continue
}
return result, nil
Expand Down Expand Up @@ -126,9 +126,9 @@ func (c3 *Client) Strategy(strategyID uint64) (*c3types.Strategy, error) {
})
}

// GetStrategyHolders returns the list of holders for the given strategy.
// StrategyHolders returns the list of holders for the given strategy.
// The returned map has the holder's address as key and the holder's balance as a string encoded big.Int
func (c3 *Client) GetStrategyHolders(strategyID uint64) (map[string]string, error) {
func (c3 *Client) StrategyHolders(strategyID uint64) (map[string]string, error) {
return requestWithRetry(func() (map[string]string, error) {
holders, err := c3.GetHoldersByStrategy(strategyID)
if err != nil {
Expand Down

0 comments on commit ca6ac27

Please sign in to comment.