Treat async loops the same.

In the name of consistency, treat the PodCache loop the same as the
EndpointController.
This commit is contained in:
Tim Hockin
2014-08-19 17:33:54 -07:00
parent caadf10197
commit edff541524
3 changed files with 7 additions and 18 deletions

View File

@@ -18,13 +18,11 @@ package master
import (
"sync"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/pod"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/golang/glog"
)
@@ -36,17 +34,15 @@ type PodCache struct {
pods pod.Registry
// This is a map of pod id to a map of container name to the
podInfo map[string]api.PodInfo
period time.Duration
podLock sync.Mutex
}
// NewPodCache returns a new PodCache which watches container information registered in the given PodRegistry.
func NewPodCache(info client.PodInfoGetter, pods pod.Registry, period time.Duration) *PodCache {
func NewPodCache(info client.PodInfoGetter, pods pod.Registry) *PodCache {
return &PodCache{
containerInfo: info,
pods: pods,
podInfo: map[string]api.PodInfo{},
period: period,
}
}
@@ -87,9 +83,3 @@ func (p *PodCache) UpdateAllContainers() {
}
}
}
// Loop begins watching updates of container information.
// It runs forever, and is expected to be placed in a go routine.
func (p *PodCache) Loop() {
util.Forever(func() { p.UpdateAllContainers() }, p.period)
}