fix: add ok check for singleflight type assertion in model probe

singleflight.Group.Do() returns any, which is type-asserted as bool
without an ok check at model_status.go:211. If a non-bool value is
returned (e.g. nil from shared/cache corruption), this panics.

Add ok check and return false (model probe failed) as a safe default.
This commit is contained in:
程智超0668000959
2026-06-07 20:54:00 +08:00
parent 10115f941c
commit a011df1ddc
+4 -1
View File
@@ -208,7 +208,10 @@ func (s *modelProbeCacheState) probe(cacheKey string, probeFunc func() bool) boo
return result, nil
})
result, _ := v.(bool)
result, ok := v.(bool)
if !ok {
return false
}
return result
}