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