fix(handler): handle trigger err correctly (#7205)

(cherry picked from commit 3c5fc31372)
This commit is contained in:
Silvan 2024-01-11 18:55:50 +01:00 committed by Livio Spring
parent 50aacb8127
commit a7ac15ff60
No known key found for this signature in database
GPG Key ID: 26BB1C2FA5952CF0

View File

@ -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)