pintracker: carry over attempt account only for operations of the same type

This commit is contained in:
Hector Sanjuan 2021-10-29 19:01:27 +02:00
parent 7cf40de354
commit c4ca5b7abe

View File

@ -83,8 +83,9 @@ func (opt *OperationTracker) TrackNewOperation(ctx context.Context, pin *api.Pin
}
op2 := NewOperation(ctx, pin, typ, ph)
if ok { // Carry over the attempt count.
// The old operation exists and was cancelled.
if ok && op.Type() == typ {
// Carry over the attempt count when doing an operation of the
// same type. The old operation exists and was cancelled.
op2.attemptCount = op.AttemptCount() // carry the count
}
logger.Debugf("'%s' on cid '%s' has been created with phase '%s'", typ, pin.Cid, ph)