From 2327d130224340dbad1717f4218fa1c86eddf43c Mon Sep 17 00:00:00 2001 From: Ben Grewell Date: Thu, 11 Mar 2021 09:15:57 -0800 Subject: [PATCH] add wait for empty reporting channel before closing --- .idea/workspace.xml | 5 +---- reporter.go | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 5b141f7..9b02378 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,10 +3,7 @@ - - - - + diff --git a/reporter.go b/reporter.go index b677cdd..3249353 100644 --- a/reporter.go +++ b/reporter.go @@ -20,6 +20,11 @@ func (r *Reporter) Stop() { r.running = false r.tailer.Stop() r.tailer.Cleanup() + for { + if len(r.ReportingChannel) == 0 { + break + } + } close(r.ReportingChannel) }