Skip to content

Commit

Permalink
refactor: use a single call to WaitGroup.Add in Publish
Browse files Browse the repository at this point in the history
  • Loading branch information
mdawar committed Aug 13, 2024
1 parent d206c63 commit e393050
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ func (b *Broker[T, P]) Publish(ctx context.Context, topic T, payload P) error {

var wg sync.WaitGroup

wg.Add(len(b.subs[topic]))
for _, sub := range b.subs[topic] {
wg.Add(1)
go func() {
defer wg.Done()

Expand Down

0 comments on commit e393050

Please sign in to comment.