This commit is contained in:
Neil Alexander 2022-09-12 11:08:14 +01:00
parent 1b49a9deff
commit 0d74b296f1
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -685,17 +685,8 @@ func (d *Database) StoreEvent(
return 0, 0, types.StateAtEvent{}, nil, "", 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)
var txn *sql.Tx if err = updater.StorePreviousEvents(eventNID, prevEvents); err != nil {
if updater != nil { return 0, 0, types.StateAtEvent{}, nil, "", fmt.Errorf("updater.StorePreviousEvents: %w", err)
txn = updater.txn
}
if err = d.Writer.Do(d.DB, txn, func(_ *sql.Tx) error {
if err = updater.StorePreviousEvents(eventNID, prevEvents); err != nil {
return fmt.Errorf("updater.StorePreviousEvents: %w", err)
}
return nil
}); err != nil {
return 0, 0, types.StateAtEvent{}, nil, "", err
} }
succeeded = true succeeded = true
} }