Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pkg/inference/scheduling/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,22 @@ func (l *loader) idleCheckDuration() time.Duration {
// Compute the oldest usage time for any idle runner.
var oldest time.Time
for _, runnerInfo := range l.runners {
// Check if this runner is defunct (process has exited)
defunct := false
select {
case <-l.slots[runnerInfo.slot].done:
// Check immediately if a runner is defunct
return 0
defunct = true
default:
}

// Only check unused runners. Defunct runners that are still in use
// will be handled when they become unused, so we don't schedule
// immediate checks for them (which would cause a tight CPU loop).
if l.references[runnerInfo.slot] == 0 {
if defunct {
// Check immediately if an unused runner is defunct
return 0
}
timestamp := l.timestamps[runnerInfo.slot]
if oldest.IsZero() || timestamp.Before(oldest) {
oldest = timestamp
Expand Down