Skip to content

Commit

Permalink
chore: extract constant as suggested by @rootulp
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Nov 20, 2024
1 parent 3600365 commit a8f8a21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rpc/grpc/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,16 @@ func (blockAPI *BlockAPI) StartNewBlockEventListener(ctx context.Context) {
}
}

// RETRY_ATTEMPTS the number of retry times when the subscritpion is closed.

Check failure on line 123 in rpc/grpc/api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

`subscritpion` is a misspelling of `subscriptions` (misspell)
const RETRY_ATTEMPTS = 6

Check failure on line 124 in rpc/grpc/api.go

View workflow job for this annotation

GitHub Actions / golangci-lint

ST1003: should not use ALL_CAPS in Go names; use CamelCase instead (stylecheck)

func (blockAPI *BlockAPI) retryNewBlocksSubscription(ctx context.Context) (bool, error) {
env := core.GetEnvironment()
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
blockAPI.Lock()
defer blockAPI.Unlock()
for i := 1; i < 6; i++ {
for i := 1; i < RETRY_ATTEMPTS; i++ {
select {
case <-ctx.Done():
return false, nil
Expand Down

0 comments on commit a8f8a21

Please sign in to comment.