aboutsummaryrefslogtreecommitdiff
path: root/syncapi/streams/streams.go
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/streams/streams.go
parentaa8ec1acbf3932b0543033bbf735225dac21676a (diff)
Fix broken `/sync` due to transaction error
Diffstat (limited to 'syncapi/streams/streams.go')
-rw-r--r--syncapi/streams/streams.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/syncapi/streams/streams.go b/syncapi/streams/streams.go
index eccbb3a4..dc854762 100644
--- a/syncapi/streams/streams.go
+++ b/syncapi/streams/streams.go
@@ -4,6 +4,7 @@ import (
"context"
"github.com/matrix-org/dendrite/internal/caching"
+ "github.com/matrix-org/dendrite/internal/sqlutil"
keyapi "github.com/matrix-org/dendrite/keyserver/api"
rsapi "github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/notifier"
@@ -72,7 +73,8 @@ func NewSyncStreamProviders(
if err != nil {
panic(err)
}
- defer snapshot.Rollback() // nolint:errcheck
+ var succeeded bool
+ defer sqlutil.EndTransactionWithCheck(snapshot, &succeeded, &err)
streams.PDUStreamProvider.Setup(ctx, snapshot)
streams.TypingStreamProvider.Setup(ctx, snapshot)
@@ -84,6 +86,7 @@ func NewSyncStreamProviders(
streams.DeviceListStreamProvider.Setup(ctx, snapshot)
streams.PresenceStreamProvider.Setup(ctx, snapshot)
+ succeeded = true
return streams
}