mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
fix: handle context correctly in processEvents (#7320)
This commit is contained in:
parent
46bffd24ee
commit
e000fdd792
@ -471,11 +471,11 @@ func (h *Handler) processEvents(ctx context.Context, config *triggerConfig) (add
|
|||||||
|
|
||||||
txCtx := ctx
|
txCtx := ctx
|
||||||
if h.txDuration > 0 {
|
if h.txDuration > 0 {
|
||||||
var cancel func()
|
var cancel, cancelTx func()
|
||||||
ctx, cancel = context.WithTimeout(ctx, h.txDuration)
|
|
||||||
defer cancel()
|
|
||||||
// add 100ms to store current state if iteration takes too long
|
// add 100ms to store current state if iteration takes too long
|
||||||
txCtx, cancel = context.WithTimeout(ctx, h.txDuration+100*time.Millisecond)
|
txCtx, cancelTx = context.WithTimeout(ctx, h.txDuration+100*time.Millisecond)
|
||||||
|
defer cancelTx()
|
||||||
|
ctx, cancel = context.WithTimeout(ctx, h.txDuration)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ func (h *Handler) setState(tx *sql.Tx, updatedState *state) error {
|
|||||||
updatedState.offset,
|
updatedState.offset,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.log().WithError(err).Debug("unable to update state")
|
h.log().WithError(err).Warn("unable to update state")
|
||||||
return err
|
return zerrors.ThrowInternal(err, "V2-WF23g2", "unable to update state")
|
||||||
}
|
}
|
||||||
if affected, err := res.RowsAffected(); affected == 0 {
|
if affected, err := res.RowsAffected(); affected == 0 {
|
||||||
h.log().OnError(err).Error("unable to check if states are updated")
|
h.log().OnError(err).Error("unable to check if states are updated")
|
||||||
|
Loading…
Reference in New Issue
Block a user