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:
1 parent
10115f941c
commit
a011df1ddc
1 file changed
+4
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user