Skip to content
This repository was archived by the owner on Apr 29, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pkg/preparer/orchestrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ func (p *Preparer) WatchForPodManifestsForNode(quitAndAck chan struct{}) {
quitChan := make(chan struct{})
errChan := make(chan error)

// buffer this with 1 manifest so that we can make sure that the
// consumer is always reading the latest manifest. Before writing to
// this channel, we will attempt to drain it first
podChan := make(chan []consul.ManifestResult, 1)
podChan := make(chan []consul.ManifestResult)

go p.store.WatchPods(consul.INTENT_TREE, p.node, quitChan, errChan, podChan)

Expand Down Expand Up @@ -119,8 +116,10 @@ func (p *Preparer) WatchForPodManifestsForNode(quitAndAck chan struct{}) {
podUniqueKey: pair.PodUniqueKey,
}
if _, ok := podChanMap[workerID]; !ok {
// spin goroutine for this pod
podChanMap[workerID] = make(chan ManifestPair)
// buffer this with 1 manifest so that we can make sure that the
// consumer is always reading the latest manifest. Before writing to
// this channel, we will attempt to drain it first
podChanMap[workerID] = make(chan ManifestPair, 1)
quitChanMap[workerID] = make(chan struct{})
go p.handlePods(podChanMap[workerID], quitChanMap[workerID])
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/preparer/orchestrate_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !race
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what race did you hit? looks like this file doesn't depend on consulutil which has known races, so if the race detector showed a problem it's probably a real problem


package preparer

import (
Expand Down