Don't overwrite global err before return (#1293)

Signed-off-by: Olivier Charvin <git@olivier.pfad.fr>
This commit is contained in:
oliverpool 2020-08-25 14:11:52 +02:00 committed by GitHub
parent c8b873abc8
commit a4db43e096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 69 additions and 64 deletions

View file

@ -60,12 +60,7 @@ func (r *RoomserverInternalAPI) updateLatestEvents(
return fmt.Errorf("r.DB.GetLatestEventsForUpdate: %w", err)
}
succeeded := false
defer func() {
txerr := sqlutil.EndTransaction(updater, &succeeded)
if err == nil && txerr != nil {
err = txerr
}
}()
defer sqlutil.EndTransactionWithCheck(updater, &succeeded, &err)
u := latestEventsUpdater{
ctx: ctx,