Skip to content

Commit

Permalink
Merge pull request #35 from ivan-stankov-golang/master
Browse files Browse the repository at this point in the history
TestShutdownEmpty
  • Loading branch information
eapache authored Feb 2, 2023
2 parents 9e1a778 + 2e37f4c commit 83b926b
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 83b926b

Please sign in to comment.