storagenode: delete piece when upload is cancelled (#2286)

* storagenode: delete piece when upload is cancelled

* don't delete when piece info has been committed
This commit is contained in:
Egon Elbre 2019-06-21 19:16:39 +03:00 committed by Stefan Benten
parent 4f2e893e68
commit 23e081f0c7

View File

@ -295,7 +295,9 @@ func (endpoint *Endpoint) Upload(stream pb.Piecestore_UploadServer) (err error)
} }
if err := endpoint.pieceinfo.Add(ctx, info); err != nil { if err := endpoint.pieceinfo.Add(ctx, info); err != nil {
return ErrInternal.Wrap(err) ignoreCancelContext := context.Background()
deleteErr := endpoint.store.Delete(ignoreCancelContext, limit.SatelliteId, limit.PieceId)
return ErrInternal.Wrap(errs.Combine(err, deleteErr))
} }
} }