Add missing transaction rollbacks for SQL store (#9964)

* Add missing transaction rollbacks for SQL store

* Add `defer transaction.Rollback()` in SQL stores.

* abstract finalizeTransaction
This commit is contained in:
κουκουλοφόρος
2019-02-23 19:44:52 +00:00
committed by Lev
parent b4d645f121
commit 5b24c44e19
11 changed files with 49 additions and 108 deletions

View File

@@ -11,7 +11,6 @@ import (
"strings"
"github.com/mattermost/gorp"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/store"
)
@@ -94,6 +93,7 @@ func (s *SqlSupplier) RoleSave(ctx context.Context, role *model.Role, hints ...s
result.Err = model.NewAppError("SqlRoleStore.RoleSave", "store.sql_role.save.open_transaction.app_error", nil, err.Error(), http.StatusInternalServerError)
return result
} else {
defer finalizeTransaction(transaction)
result = s.createRole(ctx, role, transaction, hints...)
if result.Err != nil {