3
0

Remove excessive statechange logging

This commit is contained in:
Tomaž Jerman
2024-02-02 09:20:28 +01:00
parent 5d32ea1eb4
commit cb89c9b1a4

View File

@@ -448,23 +448,19 @@ func (svc *session) stateChangeHandler(ctx context.Context) wfexec.StateChangeHa
svc.mux.Lock()
defer svc.mux.Unlock()
log := svc.log.With(
logger.Uint64("sessionID", s.ID()),
zap.Stringer("status", i),
)
ses := svc.pool[s.ID()]
if ses == nil {
log := svc.log.With(
logger.Uint64("sessionID", s.ID()),
zap.Stringer("status", status),
)
log.Warn("could not find session to update")
return
}
ses.FlushCounter++
log = log.With(logger.Uint64("workflowID", ses.WorkflowID))
log.Debug("state change handler")
var (
// By default, we want to update session when new status is prompted, delayed, completed, canceled or failed
// But if status is active, we'll flush it every X frames (sessionStateFlushFrequency)
@@ -542,6 +538,11 @@ func (svc *session) stateChangeHandler(ctx context.Context) wfexec.StateChangeHa
ses.FlushCounter = 0
ses.CopyRuntimeStacktrace()
if err := store.UpsertAutomationSession(ctx, svc.store, ses); err != nil {
log := svc.log.With(
logger.Uint64("sessionID", s.ID()),
zap.Stringer("status", status),
)
log.Error("failed to update session", zap.Error(err))
}
}