[Piuparts-commits] [piuparts] 02/04: debiman-piuparts-distill: bugfix: wait until all results are collected

Holger Levsen holger at layer-acht.org
Wed Aug 30 16:18:15 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit c7e4f8d86afe6b3ae186a06deabf84971a716f50
Author: Michael Stapelberg <stapelberg at debian.org>
Date:   Wed Aug 30 17:52:02 2017 +0200

    debiman-piuparts-distill: bugfix: wait until all results are collected
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 helpers/debiman-piuparts-distill/piuparts.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/helpers/debiman-piuparts-distill/piuparts.go b/helpers/debiman-piuparts-distill/piuparts.go
index 148e888..59aa582 100644
--- a/helpers/debiman-piuparts-distill/piuparts.go
+++ b/helpers/debiman-piuparts-distill/piuparts.go
@@ -109,10 +109,13 @@ func main() {
 	}
 	// Collect results from all workers into linksMap
 	linksMap := make(map[link]bool)
+	// Channel for signaling that all results were collected
+	collected := make(chan bool)
 	go func() {
 		for l := range linksChan {
 			linksMap[l] = true
 		}
+		collected <- true
 	}()
 	// Walk through *logsDir, enqueue all .log files onto the work channel
 	if err := filepath.Walk(*logsDir, func(path string, info os.FileInfo, err error) error {
@@ -128,6 +131,7 @@ func main() {
 	// Wait for the worker goroutines to terminate
 	wg.Wait()
 	close(linksChan)
+	<-collected
 	// Convert the unsorted linksMap into a slice for sorting
 	links := make([]link, 0, len(linksMap))
 	for l := range linksMap {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list