forked from TrueCloudLab/frostfs-node
[#1686] fstree: Return proper error for concurrent Delete
If the file doesn't exist, return `apistatus.ObjectNotFound`. First check is still there as a shortcut. Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
0b95a21701
commit
6c2d3b020f
1 changed files with 5 additions and 1 deletions
|
@ -191,7 +191,11 @@ func (t *FSTree) Delete(prm common.DeletePrm) (common.DeleteRes, error) {
|
||||||
return common.DeleteRes{}, err
|
return common.DeleteRes{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return common.DeleteRes{}, os.Remove(p)
|
err = os.Remove(p)
|
||||||
|
if err != nil && os.IsNotExist(err) {
|
||||||
|
err = apistatus.ObjectNotFound{}
|
||||||
|
}
|
||||||
|
return common.DeleteRes{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exists returns the path to the file with object contents if it exists in the storage
|
// Exists returns the path to the file with object contents if it exists in the storage
|
||||||
|
|
Loading…
Reference in a new issue