add wait for empty reporting channel before closing

This commit is contained in:
Ben Grewell
2021-03-11 09:15:57 -08:00
parent f9a882f5e4
commit 2327d13022
2 changed files with 6 additions and 4 deletions

5
.idea/workspace.xml generated
View File

@@ -3,10 +3,7 @@
<component name="ChangeListManager">
<list default="true" id="fc2840de-29dc-4fca-8e0e-a283562f60ca" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client.go" beforeDir="false" afterPath="$PROJECT_DIR$/client.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/reporter.go" beforeDir="false" afterPath="$PROJECT_DIR$/reporter.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/reporter_linux.go" beforeDir="false" afterPath="$PROJECT_DIR$/reporter_linux.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/reporter_windows.go" beforeDir="false" afterPath="$PROJECT_DIR$/reporter_windows.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -21,7 +18,7 @@
</list>
</option>
</component>
<component name="GOROOT" url="file:///usr/local/go" />
<component name="GOROOT" url="file://$PROJECT_DIR$/../../../../../Program Files/Go" />
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>

View File

@@ -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)
}