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:
parent
10115f941c
commit
a011df1ddc
1 changed files with 4 additions and 1 deletions
|
|
@ -208,7 +208,10 @@ func (s *modelProbeCacheState) probe(cacheKey string, probeFunc func() bool) boo
|
||||||
return result, nil
|
return result, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
result, _ := v.(bool)
|
result, ok := v.(bool)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue