Reset transaction after a failure

This commit is contained in:
Neil Alexander 2022-09-30 17:07:37 +01:00
parent 16048be236
commit 0116db79c6
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
11 changed files with 40 additions and 17 deletions

View file

@ -34,13 +34,13 @@ func (p *DeviceListStreamProvider) IncrementalSync(
to, _, err = internal.DeviceListCatchup(context.Background(), snapshot, p.keyAPI, p.rsAPI, req.Device.UserID, req.Response, from, to)
if err != nil {
req.Log.WithError(err).Error("internal.DeviceListCatchup failed")
_ = snapshot.Rollback()
_ = snapshot.Reset()
return from
}
err = internal.DeviceOTKCounts(req.Context, p.keyAPI, req.Device.UserID, req.Device.ID, req.Response)
if err != nil {
req.Log.WithError(err).Error("internal.DeviceListCatchup failed")
_ = snapshot.Rollback()
_ = snapshot.Reset()
return from
}