Skip to content

Commit

Permalink
AsyncBlock: Add buffer to async block channel
Browse files Browse the repository at this point in the history
There's no need to keep the matcher blocked until the channel is read.
The channel is intended as a signal only, but if it's not read we don't
want that goroutine to stick around forever.
  • Loading branch information
noseglid committed Sep 9, 2024
1 parent 9147613 commit dacc9a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion asyncblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type AsyncBlockMatcher struct {
// to wait for that invokation (using `<- matcher.Channel()`) and then do assertions.
func AsyncBlock(matcher gomock.Matcher) *AsyncBlockMatcher {
return &AsyncBlockMatcher{
ch: make(chan struct{}),
ch: make(chan struct{}, 1),
matcher: matcher,
}
}
Expand Down

0 comments on commit dacc9a8

Please sign in to comment.