mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 18:11:22 +00:00
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.
This commit is contained in:
@@ -44,6 +44,8 @@ import (
|
|||||||
"gopkg.in/v1/yaml"
|
"gopkg.in/v1/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const defaultChanSize = 1024
|
||||||
|
|
||||||
// DockerContainerData is the structured representation of the JSON object returned by Docker inspect
|
// DockerContainerData is the structured representation of the JSON object returned by Docker inspect
|
||||||
type DockerContainerData struct {
|
type DockerContainerData struct {
|
||||||
state struct {
|
state struct {
|
||||||
@@ -758,7 +760,7 @@ func (kl *Kubelet) SyncManifests(config []api.ContainerManifest) error {
|
|||||||
glog.Infof("Desired: %+v", config)
|
glog.Infof("Desired: %+v", config)
|
||||||
var err error
|
var err error
|
||||||
dockerIdsToKeep := map[DockerID]empty{}
|
dockerIdsToKeep := map[DockerID]empty{}
|
||||||
keepChannel := make(chan DockerID)
|
keepChannel := make(chan DockerID, defaultChanSize)
|
||||||
waitGroup := sync.WaitGroup{}
|
waitGroup := sync.WaitGroup{}
|
||||||
|
|
||||||
// Check for any containers that need starting
|
// Check for any containers that need starting
|
||||||
|
Reference in New Issue
Block a user