introduced benchmarks on publishing messages

This commit is contained in:
2024-08-08 13:06:57 +01:00
parent 1b3ead2dd9
commit 8d5cd7e599
7 changed files with 184 additions and 13 deletions

View File

@@ -202,15 +202,17 @@ func TestAsyncTopic_ClosedTopicError(t *testing.T) {
func TestAsyncTopic_AllPublishedBeforeClosedAreDeliveredAfterClosed(t *testing.T) {
const msgCount = 10
subscriberReady := make(chan struct{}, 1)
defer close(subscriberReady)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
topic := NewAsyncTopic[int](ctx, WithOnSubscribe(func(count int) {
subscriberReady <- struct{}{}
}))
subscriberReady := make(chan struct{}, 1)
defer close(subscriberReady)
topic := NewAsyncTopic[int](ctx,
WithOnSubscribe(func(count int) {
subscriberReady <- struct{}{}
}),
)
feedback := make(chan int) // unbuffered will cause choke point for publishers
defer close(feedback)