wait for publishing clients

This commit is contained in:
chrislu
2024-01-28 12:06:58 -08:00
parent f8c55f101e
commit b51dfe2bff
2 changed files with 16 additions and 5 deletions

View File

@@ -43,18 +43,21 @@ func main() {
CreateTopicPartitionCount: int32(*partitionCount),
}
publisher := pub_client.NewTopicPublisher(*namespace, *topic, config)
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
brokers := strings.Split(*seedBrokers, ",")
if err := publisher.StartSchedulerThread(brokers); err != nil {
if err := publisher.StartSchedulerThread(brokers, &wg); err != nil {
fmt.Println(err)
return
}
}()
wg.Wait()
startTime := time.Now()
// Start multiple publishers
var wg sync.WaitGroup
for i := 0; i < *concurrency; i++ {
wg.Add(1)
go func(id int) {