Skip to content

Commit

Permalink
fix: concurrent map iteration and map write
Browse files Browse the repository at this point in the history
  • Loading branch information
blankbro committed Aug 1, 2023
1 parent 146aed1 commit dbee309
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions storm/storm.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,11 @@ func (ms *MqttStorm) PubStorm(requestBodyBytes []byte) error {
return err
}

ms.Lock()
for _, client := range ms.MqttClientMap {
go ms.Mocker.Pub(client, requestBody)
}
ms.Unlock()

return nil
}

0 comments on commit dbee309

Please sign in to comment.