proxy: fix matrix race and process stop bug (#677)

- matrix.go change logic to consider any proxy.Process not in
StateStopped or StateShutdown
- process.StopImmediately, and Stop() which called it had a subtle bug
where it only handled state transitions from StateReady to
StateStopping. StateStarting -> StateStopping was ignored completely.

fix: #670
This commit is contained in:
Benson Wong
2026-04-20 00:21:11 -07:00
committed by GitHub
parent 57ac666598
commit 231e62291c
2 changed files with 13 additions and 6 deletions
+2 -2
View File
@@ -297,7 +297,7 @@ func (m *Matrix) Shutdown() {
wg.Wait()
}
// RunningModels returns model names currently in StateReady.
// RunningModels returns model names currently in an active (non-stopped) state.
func (m *Matrix) RunningModels() []string {
m.Lock()
defer m.Unlock()
@@ -308,7 +308,7 @@ func (m *Matrix) RunningModels() []string {
func (m *Matrix) runningModels() []string {
var running []string
for id, process := range m.processes {
if process.CurrentState() == StateReady {
if process.CurrentState() != StateStopped && process.CurrentState() != StateShutdown {
running = append(running, id)
}
}