From e6b87b622e5a4005054edb14989f3efb4fd83226 Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Thu, 4 Jan 2024 16:46:25 +0100 Subject: [PATCH] fix: correctly respect maxFailureCount (#7143) --- .../repository/eventsourcing/view/token.go | 22 ------------------- internal/eventstore/handler/v2/handler.go | 5 ++++- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/internal/authz/repository/eventsourcing/view/token.go b/internal/authz/repository/eventsourcing/view/token.go index 47667ae68e..885a5ab2bc 100644 --- a/internal/authz/repository/eventsourcing/view/token.go +++ b/internal/authz/repository/eventsourcing/view/token.go @@ -4,11 +4,9 @@ import ( "context" "github.com/zitadel/zitadel/internal/api/authz" - "github.com/zitadel/zitadel/internal/eventstore/v1/models" "github.com/zitadel/zitadel/internal/query" usr_view "github.com/zitadel/zitadel/internal/user/repository/view" usr_view_model "github.com/zitadel/zitadel/internal/user/repository/view/model" - "github.com/zitadel/zitadel/internal/zerrors" ) const ( @@ -19,26 +17,6 @@ func (v *View) TokenByIDs(tokenID, userID, instanceID string) (*usr_view_model.T return usr_view.TokenByIDs(v.Db, tokenTable, tokenID, userID, instanceID) } -func (v *View) PutToken(token *usr_view_model.TokenView, event *models.Event) error { - return usr_view.PutToken(v.Db, tokenTable, token) -} - -func (v *View) DeleteToken(tokenID, instanceID string, event *models.Event) error { - err := usr_view.DeleteToken(v.Db, tokenTable, tokenID, instanceID) - if err != nil && !zerrors.IsNotFound(err) { - return err - } - return nil -} - -func (v *View) DeleteSessionTokens(agentID, userID, instanceID string, event *models.Event) error { - err := usr_view.DeleteSessionTokens(v.Db, tokenTable, agentID, userID, instanceID) - if err != nil && !zerrors.IsNotFound(err) { - return err - } - return nil -} - func (v *View) GetLatestState(ctx context.Context) (_ *query.CurrentState, err error) { q := &query.CurrentStateSearchQueries{ Queries: make([]query.SearchQuery, 2), diff --git a/internal/eventstore/handler/v2/handler.go b/internal/eventstore/handler/v2/handler.go index fb20ebbb9e..0bc2020efa 100644 --- a/internal/eventstore/handler/v2/handler.go +++ b/internal/eventstore/handler/v2/handler.go @@ -454,7 +454,10 @@ func (h *Handler) executeStatement(ctx context.Context, tx *sql.Tx, currentState } var shouldContinue bool defer func() { - _, err = tx.Exec("RELEASE SAVEPOINT exec") + _, errSave := tx.Exec("RELEASE SAVEPOINT exec") + if err == nil { + err = errSave + } }() if err = statement.Execute(tx, h.projection.Name()); err != nil {