Harden unload for empty runners

This commit is contained in:
Daniel Hiltgen 2024-05-30 16:43:40 -07:00
parent 68dfc6236a
commit 48702dd149

View file

@ -588,6 +588,10 @@ func (s *Scheduler) findRunnerToUnload() *runnerRef {
runnerList = append(runnerList, r)
}
s.loadedMu.Unlock()
if len(runnerList) == 0 {
slog.Debug("no loaded runner to unload")
return nil
}
// In the future we can enhance the algorithm to be smarter about picking the optimal runner to unload
// e.g., if we have multiple options, will one make room for the request?