Skip to content

Commit

Permalink
Merge pull request #193 from klim0v/patch-1
Browse files Browse the repository at this point in the history
Update retrier.go
  • Loading branch information
xssnick authored May 19, 2024
2 parents 59ed8f5 + d5784a6 commit a900544
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions ton/retrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,23 @@ func (w *retryClient) QueryLiteserver(ctx context.Context, payload tl.Serializab
tries++

if err != nil {
if errors.Is(err, liteclient.ErrADNLReqTimeout) {
// try next node
ctx, err = w.original.StickyContextNextNode(ctx)
if err != nil {
return fmt.Errorf("timeout error received, but failed to try with next node, "+
"looks like all active nodes was already tried, original error: %w", err)
}
if !errors.Is(err, liteclient.ErrADNLReqTimeout) && !errors.Is(err, context.DeadlineExceeded){
return err
}

continue
err := ctx.Err()
if err != nil {
return err
}
if errors.Is(err, context.DeadlineExceeded) {
err := ctx.Err()
if err != nil {
return err
}

continue

// try next node
ctx, err = w.original.StickyContextNextNode(ctx)
if err != nil {
return fmt.Errorf("timeout error received, but failed to try with next node, "+
"looks like all active nodes was already tried, original error: %w", err)
}

return err
continue
}

if tmp, ok := result.(*tl.Serializable); ok && tmp != nil {
Expand Down

0 comments on commit a900544

Please sign in to comment.