From a9aff0c0bb4ebcf7b62f663ee17730f3d59b0575 Mon Sep 17 00:00:00 2001 From: Alexander Pochill Date: Mon, 9 Sep 2024 08:54:17 +0200 Subject: [PATCH] AsyncBlock: Add buffer to async block channel 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. --- asyncblock.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncblock.go b/asyncblock.go index 5d40dec..73feb1c 100644 --- a/asyncblock.go +++ b/asyncblock.go @@ -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{}, 1024), matcher: matcher, } }