Skip to content

Commit

Permalink
improve windows file tailer shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
fstab committed Jun 6, 2019
1 parent 41c13c3 commit 49fe484
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions tailer/fswatcher/fseventProducerLoop_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,19 @@ func runWinWatcherLoop(w *winfsnotify.Watcher) *winwatcherloop {
for {
select {
case event := <-w.Event:
events <- event
select {
case events <- event:
case <-done:
w.Close()
return
}
case err := <-w.Error:
errors <- NewError(NotSpecified, err, "")
select {
case errors <- NewError(NotSpecified, err, ""):
case <-done:
w.Close()
return
}
case <-done:
w.Close()
return
Expand Down
2 changes: 1 addition & 1 deletion tailer/fswatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func assertGoroutinesTerminated(t *testing.T, ctx *context, nGoroutinesBefore in
nHangingGoroutines := runtime.NumGoroutine() - nGoroutinesBefore
if nHangingGoroutines > 0 {
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
fatalf(t, ctx, "%v goroutines did not shut down properly.", nHangingGoroutines)
fatalf(t, ctx, "%v goroutine(s) did not shut down properly.", nHangingGoroutines)
}
}

Expand Down

0 comments on commit 49fe484

Please sign in to comment.