From 0d74b296f1cc6bfe4416e5b0d85c2d3ed69576ab Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 12 Sep 2022 11:08:14 +0100 Subject: [PATCH] Simplify --- roomserver/storage/shared/storage.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go index 2b1223a98..ff71fc9f1 100644 --- a/roomserver/storage/shared/storage.go +++ b/roomserver/storage/shared/storage.go @@ -685,17 +685,8 @@ func (d *Database) StoreEvent( return 0, 0, types.StateAtEvent{}, nil, "", fmt.Errorf("GetRoomUpdater: %w", err) } defer sqlutil.EndTransactionWithCheck(updater, &succeeded, &err) - var txn *sql.Tx - if updater != nil { - 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 + if err = updater.StorePreviousEvents(eventNID, prevEvents); err != nil { + return 0, 0, types.StateAtEvent{}, nil, "", fmt.Errorf("updater.StorePreviousEvents: %w", err) } succeeded = true }