From f3e423cc5a881bbfb3cf4670ca60a8507e333cce Mon Sep 17 00:00:00 2001 From: Yihang Wang Date: Thu, 28 Mar 2024 23:08:22 +0800 Subject: [PATCH] fix: task count increment bug in scheduler.go --- scheduler.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scheduler.go b/scheduler.go index 879be34..76d75fe 100644 --- a/scheduler.go +++ b/scheduler.go @@ -269,10 +269,13 @@ func (s *Scheduler) Worker() { data, err := json.Marshal(task) if err != nil { slog.Error("error occured while serializing task", slog.String("error", err.Error())) - s.FailedTaskCount.Add(1) } else { s.logWg.Add(1) s.LogChan <- string(data) + } + if task.Error != "" { + s.FailedTaskCount.Add(1) + } else { s.SucceedTaskCount.Add(1) } // Notify task is done