Skip to content

Commit

Permalink
Ignore error for making identical deals (data-preservation-programs#427)
Browse files Browse the repository at this point in the history
In the case where provider failed to return success response,
Singularity will retry the same deal which may end up with being
rejected as boost has already received the same deal proposal.

This makes Singularity continue to next deal instead of keep retrying on
the same "identical deal" error message.

---------

Co-authored-by: liuziba <lisashane16@gmail.com>
  • Loading branch information
xinaxu and liuziba authored Dec 30, 2023
1 parent 5c597b4 commit 0bcd973
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions service/dealpusher/dealpusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dealpusher

import (
"context"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -376,14 +377,21 @@ func (d *DealPusher) runSchedule(ctx context.Context, schedule *model.Schedule)
})
if err != nil {
Logger.Errorw("failed to send deal", "error", err, "provider", schedule.Provider)
if strings.Contains(err.Error(), "deal proposal is identical") {
return nil
}
}

return errors.WithStack(err)
}, retry.Attempts(d.sendDealAttempts), retry.Delay(time.Second),
retry.DelayType(retry.FixedDelay), retry.Context(ctx))
if err != nil {
return "", errors.Wrap(err, "failed to send deal")
}

if dealModel == nil {
continue
}
dealModel.ScheduleID = &schedule.ID

Logger.Debugw("save accepted deal", "deal", dealModel)
Expand Down

0 comments on commit 0bcd973

Please sign in to comment.