Simplify
This commit is contained in:
parent
1b49a9deff
commit
0d74b296f1
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue