Pods immediately terminate for idletimeout in new deployment and container executer type (#2459)

* added waitgroup to handle multiple goroutine scenario
* changes for cache service
* changes to get function service from cache by UID
This commit is contained in:
Shubham Bansal
2022-06-29 11:49:34 +05:30
committed by GitHub
parent 473acc4e2b
commit c71867169b
4 changed files with 216 additions and 211 deletions
+8 -2
View File
@@ -130,10 +130,16 @@ func (fsc *FunctionServiceCache) service() {
resp.error = fsc._touchByAddress(req.address)
case LISTOLD:
// get svcs idle for > req.age
fscs := fsc.byFunction.Copy()
fscs := fsc.byFunctionUID.Copy()
funcObjects := make([]*FuncSvc, 0)
for _, funcSvc := range fscs {
fsvc := funcSvc.(*FuncSvc)
mI := funcSvc.(metav1.ObjectMeta)
fsvcI, err := fsc.byFunction.Get(crd.CacheKey(&mI))
if err != nil {
fsc.logger.Error("error while getting service", zap.Any("error", err))
return
}
fsvc := fsvcI.(*FuncSvc)
if time.Since(fsvc.Atime) > req.age {
funcObjects = append(funcObjects, fsvc)
}