[#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
}
settings := &data.BucketSettings{}
obj, err := n.getSystemObjectFromNeoFS(ctx, bktInfo, bktInfo.SettingsObjectName())
if err != nil {
if errors.IsS3Error(err, errors.ErrNoSuchKey) {
return &data.BucketSettings{}, nil
}
if !errors.IsS3Error(err, errors.ErrNoSuchKey) {
return nil, err
}
settings := &data.BucketSettings{}
if err = json.Unmarshal(obj.Payload(), settings); err != nil {
} else if err = json.Unmarshal(obj.Payload(), settings); err != nil {
return nil, err
}