[#439] Less cache misses for empty bucket setting

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-05-17 16:03:38 +03:00 committed by Alex Vanin
parent 1012a3c6a4
commit 2575462daa

View file

@ -238,16 +238,14 @@ func (n *layer) GetBucketSettings(ctx context.Context, bktInfo *data.BucketInfo)
return settings, nil return settings, nil
} }
settings := &data.BucketSettings{}
obj, err := n.getSystemObjectFromNeoFS(ctx, bktInfo, bktInfo.SettingsObjectName()) obj, err := n.getSystemObjectFromNeoFS(ctx, bktInfo, bktInfo.SettingsObjectName())
if err != nil { if err != nil {
if errors.IsS3Error(err, errors.ErrNoSuchKey) { if !errors.IsS3Error(err, errors.ErrNoSuchKey) {
return &data.BucketSettings{}, nil return nil, err
} }
return nil, err } else if err = json.Unmarshal(obj.Payload(), settings); err != nil {
}
settings := &data.BucketSettings{}
if err = json.Unmarshal(obj.Payload(), settings); err != nil {
return nil, err return nil, err
} }