diff --git a/api/layer/layer.go b/api/layer/layer.go index 67c875bbd..0e18081e6 100644 --- a/api/layer/layer.go +++ b/api/layer/layer.go @@ -890,9 +890,9 @@ func (n *layer) DeleteBucket(ctx context.Context, p *DeleteBucketParams) error { return errors.GetAPIError(errors.ErrBucketNotEmpty) } + n.bucketCache.Delete(bucketInfo.Name) if err = n.deleteContainer(ctx, bucketInfo.CID); err != nil { return err } - n.bucketCache.Delete(bucketInfo.Name) return nil } diff --git a/api/layer/object.go b/api/layer/object.go index f9238c6ec..e953b3913 100644 --- a/api/layer/object.go +++ b/api/layer/object.go @@ -189,17 +189,17 @@ func (n *layer) objectPut(ctx context.Context, bkt *data.BucketInfo, p *PutObjec n.prepareAuthParameters(ctx, &prm.PrmAuth) - id, err := n.neoFS.CreateObject(ctx, prm) - if err != nil { - return nil, n.transformNeofsError(ctx, err) - } - if p.Header[VersionsDeleteMarkAttr] == DelMarkFullObject { if last := versions.getLast(); last != nil { n.objCache.Delete(last.Address()) } } + id, err := n.neoFS.CreateObject(ctx, prm) + if err != nil { + return nil, n.transformNeofsError(ctx, err) + } + meta, err := n.objectHead(ctx, bkt.CID, id) if err != nil { return nil, err diff --git a/api/layer/system_object.go b/api/layer/system_object.go index 76f174353..ff16a69c2 100644 --- a/api/layer/system_object.go +++ b/api/layer/system_object.go @@ -51,13 +51,13 @@ func (n *layer) deleteSystemObject(ctx context.Context, bktInfo *data.BucketInfo return err } + n.systemCache.Delete(systemObjectKey(bktInfo, name)) for i := range ids { if err = n.objectDelete(ctx, bktInfo.CID, &ids[i]); err != nil { return err } } - n.systemCache.Delete(systemObjectKey(bktInfo, name)) return nil }