mirror of https://github.com/portainer/portainer
fix(boltdb): remove extra allocation and copy from GetObject() EE-5622 (#9111)
parent
716c196682
commit
b12e1aade4
|
@ -28,10 +28,7 @@ func (tx *DbTransaction) GetObject(bucketName string, key []byte, object interfa
|
||||||
return fmt.Errorf("%w (bucket=%s, key=%s)", dserrors.ErrObjectNotFound, bucketName, keyToString(key))
|
return fmt.Errorf("%w (bucket=%s, key=%s)", dserrors.ErrObjectNotFound, bucketName, keyToString(key))
|
||||||
}
|
}
|
||||||
|
|
||||||
data := make([]byte, len(value))
|
return tx.conn.UnmarshalObjectWithJsoniter(value, object)
|
||||||
copy(data, value)
|
|
||||||
|
|
||||||
return tx.conn.UnmarshalObjectWithJsoniter(data, object)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *DbTransaction) UpdateObject(bucketName string, key []byte, object interface{}) error {
|
func (tx *DbTransaction) UpdateObject(bucketName string, key []byte, object interface{}) error {
|
||||||
|
|
Loading…
Reference in New Issue