Skip to content

Commit 5e4e8af

Browse files
committed
Fix: Keep frozen workload cache when etcd is empty in recovery
1 parent 3682e3c commit 5e4e8af

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

persys-scheduler/internal/scheduler/scheduler.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,11 @@ func (s *Scheduler) GetWorkloads() ([]models.Workload, error) {
509509
}
510510
workloads = append(workloads, workload)
511511
}
512+
if s.currentMode() != ModeNormal && len(workloads) == 0 {
513+
// In recovery mode etcd may be reachable but state still empty.
514+
// Preserve and serve the frozen cache snapshot for operator visibility.
515+
return s.getCachedWorkloads(), nil
516+
}
512517

513518
s.withCacheLock(func() {
514519
s.cacheWorkloads = map[string]models.Workload{}

0 commit comments

Comments
 (0)