mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 09:43:10 -06:00
Improve error, fix another case where transaction wasn't used properly
This commit is contained in:
parent
e2d377e338
commit
1128632eaa
|
|
@ -133,7 +133,7 @@ func (r *Inputer) processRoomEvent(
|
|||
// event.
|
||||
isCreateEvent := event.Type() == gomatrixserverlib.MRoomCreate && event.StateKeyEquals("")
|
||||
if !updater.RoomExists() && !isCreateEvent {
|
||||
return rollbackTransaction, fmt.Errorf("room does not exist")
|
||||
return rollbackTransaction, fmt.Errorf("room %s does not exist for event %s", event.RoomID(), event.EventID())
|
||||
}
|
||||
|
||||
var missingAuth, missingPrev bool
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ func prepareEventJSONTable(db *sql.DB) (tables.EventJSON, error) {
|
|||
func (s *eventJSONStatements) InsertEventJSON(
|
||||
ctx context.Context, txn *sql.Tx, eventNID types.EventNID, eventJSON []byte,
|
||||
) error {
|
||||
_, err := s.insertEventJSONStmt.ExecContext(ctx, int64(eventNID), eventJSON)
|
||||
stmt := sqlutil.TxStmt(txn, s.insertEventJSONStmt)
|
||||
_, err := stmt.ExecContext(ctx, int64(eventNID), eventJSON)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -553,7 +553,7 @@ func (d *Database) storeEvent(
|
|||
err error
|
||||
)
|
||||
var txn *sql.Tx
|
||||
if updater != nil {
|
||||
if updater == nil || updater.txn != nil {
|
||||
txn = updater.txn
|
||||
}
|
||||
err = d.Writer.Do(d.DB, txn, func(txn *sql.Tx) error {
|
||||
|
|
|
|||
Loading…
Reference in a new issue