Skip to content

Commit

Permalink
TestShutdownEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-stankov-golang committed Feb 2, 2023
1 parent 2fd7ddd commit 5edc17c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions batcher/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ func (b *Batcher) Shutdown(wait bool) {
b.flush()

if wait {
// wait done channel
<-b.done
if b.done != nil {
// wait done channel
<-b.done
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions batcher/batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ func TestShutdownSuccess(t *testing.T) {
}
}

func TestShutdownEmpty(t *testing.T) {
b := New(10*time.Millisecond, returnsSuccess)
b.Shutdown(true)
}

func TestBatcherError(t *testing.T) {
b := New(10*time.Millisecond, returnsError)

Expand Down

0 comments on commit 5edc17c

Please sign in to comment.