From 3c5fc313723bb8c6b8423cb39db48d66c456d7f1 Mon Sep 17 00:00:00 2001 From: Silvan Date: Thu, 11 Jan 2024 18:55:50 +0100 Subject: [PATCH] fix(handler): handle trigger err correctly (#7205) --- internal/eventstore/handler/v2/handler.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/eventstore/handler/v2/handler.go b/internal/eventstore/handler/v2/handler.go index 93709015ef..36eb1ef138 100644 --- a/internal/eventstore/handler/v2/handler.go +++ b/internal/eventstore/handler/v2/handler.go @@ -145,6 +145,7 @@ func (h *Handler) schedule(ctx context.Context) { _, err = h.Trigger(instanceCtx) instanceFailed = instanceFailed || err != nil h.log().WithField("instance", instance).OnError(err).Info("scheduled trigger failed") + time.Sleep(h.retryFailedAfter) // retry if trigger failed for ; err != nil; _, err = h.Trigger(instanceCtx) { time.Sleep(h.retryFailedAfter) @@ -336,7 +337,10 @@ func (h *Handler) processEvents(ctx context.Context, config *triggerConfig) (add h.log().OnError(rollbackErr).Debug("unable to rollback tx") return } - err = tx.Commit() + commitErr := tx.Commit() + if err == nil { + err = commitErr + } }() currentState, err := h.currentState(ctx, tx, config)