From 3a955722902e4a3abbb927d758535ac4feaa82d6 Mon Sep 17 00:00:00 2001 From: Yifan Gu Date: Mon, 14 Jul 2014 13:12:44 -0700 Subject: [PATCH] Changed the keepChannel to buffered channel. Since the keepChannel is used to send data, not just for synchronizaiton, so make it a buffered channel can avoid unnecessary goroutine yields. --- pkg/kubelet/kubelet.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 98f23e4ee54..263f6c89f82 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -44,6 +44,8 @@ import ( "gopkg.in/v1/yaml" ) +const defaultChanSize = 1024 + // DockerContainerData is the structured representation of the JSON object returned by Docker inspect type DockerContainerData struct { state struct { @@ -758,7 +760,7 @@ func (kl *Kubelet) SyncManifests(config []api.ContainerManifest) error { glog.Infof("Desired: %+v", config) var err error dockerIdsToKeep := map[DockerID]empty{} - keepChannel := make(chan DockerID) + keepChannel := make(chan DockerID, defaultChanSize) waitGroup := sync.WaitGroup{} // Check for any containers that need starting