Reporting ETag failures correctly in delete method
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
parent
12d2e7852c
commit
3060cc7a42
|
|
@ -242,11 +242,9 @@ func (r *StateStore) writeFile(ctx context.Context, req *state.SetRequest) error
|
||||||
r.logger.Debugf("write file %s, err %s", req.Key, err)
|
r.logger.Debugf("write file %s, err %s", req.Key, err)
|
||||||
|
|
||||||
// Check if the error is due to ETag conflict
|
// Check if the error is due to ETag conflict
|
||||||
if isETagConflictError(err) {
|
if req.ETag != nil && isETagConflictError(err) {
|
||||||
if req.ETag != nil {
|
|
||||||
return state.NewETagError(state.ETagMismatch, err)
|
return state.NewETagError(state.ETagMismatch, err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -307,7 +305,7 @@ func (r *StateStore) deleteFile(ctx context.Context, req *state.DeleteRequest) e
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.logger.Debugf("delete file %s, err %s", req.Key, err)
|
r.logger.Debugf("delete file %s, err %s", req.Key, err)
|
||||||
|
|
||||||
if req.ETag != nil {
|
if req.ETag != nil && isETagConflictError(err) {
|
||||||
return state.NewETagError(state.ETagMismatch, err)
|
return state.NewETagError(state.ETagMismatch, err)
|
||||||
} else if isNotFoundError(err) {
|
} else if isNotFoundError(err) {
|
||||||
// deleting an item that doesn't exist without specifying an ETAG is a noop
|
// deleting an item that doesn't exist without specifying an ETAG is a noop
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue