[#136] registry: Apply updates in batch

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-05-03 13:56:45 +03:00
parent 7f139734b1
commit e5af4112f9

View file

@ -44,7 +44,7 @@ func NewObjRegistry(ctx context.Context, dbFilePath string) *ObjRegistry {
} }
func (o *ObjRegistry) AddObject(cid, oid, s3Bucket, s3Key, payloadHash string) error { func (o *ObjRegistry) AddObject(cid, oid, s3Bucket, s3Key, payloadHash string) error {
return o.boltDB.Update(func(tx *bbolt.Tx) error { return o.boltDB.Batch(func(tx *bbolt.Tx) error {
b, err := tx.CreateBucketIfNotExists([]byte(statusCreated)) b, err := tx.CreateBucketIfNotExists([]byte(statusCreated))
if err != nil { if err != nil {
return err return err