Always call overridden form of GetLatestEventsForUpdate
This ensures we don't make txns on sqlite still, which can cause
'database is locked' errors.
MODIFY
roomserver/storage/shared/storage.go
roomserver/storage/shared/storage.go
@@ -44,6 +44,7 @@ type Database struct {
MembershipTable tables.Membership
PublishedTable tables.Published
RedactionsTable tables.Redactions
+ GetLatestEventsForUpdateFn func(ctx context.Context, roomInfo types.RoomInfo) (*LatestEventsUpdater, error)
}
func (d *Database) SupportsConcurrentRoomInputs() bool {
@@ -372,6 +373,9 @@ func (d *Database) MembershipUpdater(
func (d *Database) GetLatestEventsForUpdate(
ctx context.Context, roomInfo types.RoomInfo,
) (*LatestEventsUpdater, error) {
+ if d.GetLatestEventsForUpdateFn != nil {
+ return d.GetLatestEventsForUpdateFn(ctx, roomInfo)
+ }
txn, err := d.DB.Begin()
if err != nil {
return nil, err

MODIFY
roomserver/storage/sqlite3/storage.go
roomserver/storage/sqlite3/storage.go
@@ -137,6 +137,7 @@ func Open(dbProperties *config.DatabaseOptions, cache caching.RoomServerCaches)
MembershipTable: d.membership,
PublishedTable: published,
RedactionsTable: redactions,
+ GetLatestEventsForUpdateFn: d.GetLatestEventsForUpdate,
}
return &d, nil
}

Always call overridden form of GetLatestEventsForUpdate (#1554)

This ensures we don't make txns on sqlite still, which can cause
'database is locked' errors.