[hotfix] Fix running task stats without concurrency keys (#2452)

* fix task stats running

* formatting

* if block fix
This commit is contained in:
Mohammed Nafees
2025-10-29 02:49:52 +05:30
committed by GitHub
parent 56eb054a1e
commit f1eccfddf4
4 changed files with 29 additions and 22 deletions

View File

@@ -111,18 +111,25 @@ func ToTaskStats(stats map[string]v1.TaskStat) gen.TaskStats {
}
func toTaskStatusStat(stat v1.TaskStatusStat) *gen.TaskStatusStat {
concurrency := make([]gen.ConcurrencyStat, len(stat.Concurrency))
for i, c := range stat.Concurrency {
concurrency[i] = gen.ConcurrencyStat{
Expression: &c.Expression,
Type: &c.Type,
Keys: &c.Keys,
}
result := &gen.TaskStatusStat{
Total: &stat.Total,
}
return &gen.TaskStatusStat{
Total: &stat.Total,
Queues: &stat.Queues,
Concurrency: &concurrency,
if len(stat.Concurrency) > 0 {
concurrency := make([]gen.ConcurrencyStat, len(stat.Concurrency))
for i, c := range stat.Concurrency {
concurrency[i] = gen.ConcurrencyStat{
Expression: &c.Expression,
Type: &c.Type,
Keys: &c.Keys,
}
}
result.Concurrency = &concurrency
}
if len(stat.Queues) > 0 {
result.Queues = &stat.Queues
}
return result
}