Differentiate by environment in fscache eviction (#361)
This commit is contained in:
@@ -59,6 +59,7 @@ type (
|
||||
address string
|
||||
podName string
|
||||
age time.Duration
|
||||
env *api.ObjectMeta // used for ListOld
|
||||
responseChannel chan *fscResponse
|
||||
}
|
||||
fscResponse struct {
|
||||
@@ -98,7 +99,9 @@ func (fsc *functionServiceCache) service() {
|
||||
resp.error = err
|
||||
} else {
|
||||
fsvc := fsvcI.(*funcSvc)
|
||||
if time.Now().Sub(fsvc.atime) > req.age {
|
||||
if fsvc.environment.Metadata.UID == req.env.UID &&
|
||||
time.Now().Sub(fsvc.atime) > req.age {
|
||||
|
||||
podName := podNameI.(string)
|
||||
pods = append(pods, podName)
|
||||
}
|
||||
@@ -241,11 +244,12 @@ func (fsc *functionServiceCache) _deleteByPod(podName string, minAge time.Durati
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (fsc *functionServiceCache) ListOld(age time.Duration) ([]string, error) {
|
||||
func (fsc *functionServiceCache) ListOld(env *api.ObjectMeta, age time.Duration) ([]string, error) {
|
||||
responseChannel := make(chan *fscResponse)
|
||||
fsc.requestChannel <- &fscRequest{
|
||||
requestType: LISTOLD,
|
||||
age: age,
|
||||
env: env,
|
||||
responseChannel: responseChannel,
|
||||
}
|
||||
resp := <-responseChannel
|
||||
|
||||
+1
-1
@@ -620,7 +620,7 @@ func (gp *GenericPool) CleanupFunctionService(podName string) error {
|
||||
func (gp *GenericPool) idlePodReaper() {
|
||||
for {
|
||||
time.Sleep(time.Minute)
|
||||
podNames, err := gp.fsCache.ListOld(gp.idlePodReapTime)
|
||||
podNames, err := gp.fsCache.ListOld(&gp.env.Metadata, gp.idlePodReapTime)
|
||||
if err != nil {
|
||||
log.Printf("Error reaping idle pods: %v", err)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user