mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
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:
@@ -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