Skip to content

Commit

Permalink
Handle not ready error gracefully in participator
Browse files Browse the repository at this point in the history
Back off and get a fresh token if F3 is not ready.
  • Loading branch information
masih committed Oct 8, 2024
1 parent f1e21bf commit 73359d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/api_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (
// ErrF3ParticipationTicketStartBeforeExisting signals that participation ticket
// is before the start instance of an existing lease held by the miner.
ErrF3ParticipationTicketStartBeforeExisting = errF3ParticipationTicketStartBeforeExisting{}
// ErrF3NotREady signals that the F3 instance isn't ready for participation yet. The caller
// ErrF3NotReady signals that the F3 instance isn't ready for participation yet. The caller
// should back off and try again later.
ErrF3NotReady = errF3NotReady{}

Expand Down
4 changes: 4 additions & 0 deletions node/modules/storageminer.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ func (p *f3Participator) tryF3Participate(ctx context.Context, ticket api.F3Part
p.backOff(ctx)
log.Debugw("Reattempting F3 participation with the same ticket.", "attempts", p.backoff.Attempt())
continue
case errors.Is(err, api.ErrF3NotReady):
log.Warnw("F3 is not ready. Retrying F3 participation after backoff.", "backoff", p.backoff.Duration(), "err", err)
p.backOff(ctx)
continue
case err != nil:
log.Errorw("Unexpected error while attempting F3 participation. Retrying after backoff", "backoff", p.backoff.Duration(), "attempts", p.backoff.Attempt(), "err", err)
p.backOff(ctx)
Expand Down

0 comments on commit 73359d6

Please sign in to comment.