aboutsummaryrefslogtreecommitdiff
path: root/syncapi/consumers
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-09-30 16:07:18 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-09-30 16:07:18 +0100
commitee40a29e55eb7986e16bb24bd388fb710e43aea9 (patch)
treeacdc641c351d7b7c1f8da9760e54fec599878aa1 /syncapi/consumers
parentaa8ec1acbf3932b0543033bbf735225dac21676a (diff)
Fix broken `/sync` due to transaction error
Diffstat (limited to 'syncapi/consumers')
-rw-r--r--syncapi/consumers/roomserver.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go
index e5e8fe29..c7a11dbb 100644
--- a/syncapi/consumers/roomserver.go
+++ b/syncapi/consumers/roomserver.go
@@ -27,6 +27,7 @@ import (
"github.com/tidwall/gjson"
"github.com/matrix-org/dendrite/internal/fulltext"
+ "github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/dendrite/setup/jetstream"
@@ -454,7 +455,8 @@ func (s *OutputRoomEventConsumer) updateStateEvent(event *gomatrixserverlib.Head
if err != nil {
return nil, err
}
- defer snapshot.Rollback() // nolint:errcheck
+ var succeeded bool
+ defer sqlutil.EndTransactionWithCheck(snapshot, &succeeded, &err)
prevEvent, err := snapshot.GetStateEvent(
s.ctx, event.RoomID(), event.Type(), stateKey,
@@ -474,6 +476,7 @@ func (s *OutputRoomEventConsumer) updateStateEvent(event *gomatrixserverlib.Head
}
event.Event, err = event.SetUnsigned(prev)
+ succeeded = true
return event, err
}