fix: keep schedulers alive without metrics

This commit is contained in:
2026-09-20 17:31:38 +08:00
parent 69a6b79fb0
commit 8d5274f652
2 changed files with 16 additions and 3 deletions

View File

@@ -119,7 +119,9 @@ func run() error {
call, cancel := context.WithTimeout(workflowCtx, 5*time.Second)
_, err := workflows.Tick(call, 100)
cancel()
metrics.RecordBatch("workflow", started, err)
if metrics != nil {
metrics.RecordBatch("workflow", started, err)
}
if err != nil && workflowCtx.Err() == nil {
slog.Error("workflow batch failed", "node_id", node)
}
@@ -142,7 +144,9 @@ func run() error {
call, cancel := context.WithTimeout(scheduleCtx, 5*time.Second)
_, err := schedules.Tick(call, 100)
cancel()
metrics.RecordBatch("schedule", started, err)
if metrics != nil {
metrics.RecordBatch("schedule", started, err)
}
if err != nil && scheduleCtx.Err() == nil {
slog.Error("schedule batch failed", "node_id", node)
}
@@ -170,7 +174,9 @@ func run() error {
call, cancel := context.WithTimeout(recoveryCtx, 5*time.Second)
_, err := executions.Recover(call, 100)
cancel()
metrics.RecordBatch("execution_recovery", started, err)
if metrics != nil {
metrics.RecordBatch("execution_recovery", started, err)
}
if err != nil && recoveryCtx.Err() == nil {
slog.Error("execution recovery batch failed", "node_id", node)
}