mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-23 06:41:56 -06:00
Try that again
This commit is contained in:
parent
ee4d8d6de7
commit
35f417627d
|
@ -682,22 +682,22 @@ func (d *Database) storeEvent(
|
||||||
// any other so this is fine. If we ever update GetLatestEventsForUpdate or NewLatestEventsUpdater
|
// any other so this is fine. If we ever update GetLatestEventsForUpdate or NewLatestEventsUpdater
|
||||||
// to do writes however then this will need to go inside `Writer.Do`.
|
// to do writes however then this will need to go inside `Writer.Do`.
|
||||||
succeeded := false
|
succeeded := false
|
||||||
if err = d.Writer.Do(nil, nil, func(txn *sql.Tx) error {
|
|
||||||
if updater == nil {
|
if updater == nil {
|
||||||
var roomInfo *types.RoomInfo
|
var roomInfo *types.RoomInfo
|
||||||
roomInfo, err = d.roomInfo(ctx, txn, event.RoomID())
|
roomInfo, err = d.roomInfo(ctx, txn, event.RoomID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("d.RoomInfo: %w", err)
|
return 0, 0, types.StateAtEvent{}, nil, "", fmt.Errorf("d.RoomInfo: %w", err)
|
||||||
}
|
}
|
||||||
if roomInfo == nil && len(prevEvents) > 0 {
|
if roomInfo == nil && len(prevEvents) > 0 {
|
||||||
return fmt.Errorf("expected room %q to exist", event.RoomID())
|
return 0, 0, types.StateAtEvent{}, nil, "", fmt.Errorf("expected room %q to exist", event.RoomID())
|
||||||
}
|
}
|
||||||
updater, err = d.GetRoomUpdater(ctx, roomInfo)
|
updater, err = d.GetRoomUpdater(ctx, roomInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("GetRoomUpdater: %w", err)
|
return 0, 0, types.StateAtEvent{}, nil, "", fmt.Errorf("GetRoomUpdater: %w", err)
|
||||||
}
|
}
|
||||||
defer sqlutil.EndTransactionWithCheck(updater, &succeeded, &err)
|
defer sqlutil.EndTransactionWithCheck(updater, &succeeded, &err)
|
||||||
}
|
}
|
||||||
|
if err = d.Writer.Do(nil, nil, func(_ *sql.Tx) error {
|
||||||
if err = updater.StorePreviousEvents(eventNID, prevEvents); err != nil {
|
if err = updater.StorePreviousEvents(eventNID, prevEvents); err != nil {
|
||||||
return fmt.Errorf("updater.StorePreviousEvents: %w", err)
|
return fmt.Errorf("updater.StorePreviousEvents: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue