Skip to content

Commit bb8d508

Browse files
authored
fix: PubSub isn't concurrency-safe (#3360)
1 parent 4bd5d41 commit bb8d508

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pubsub.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ func (c *PubSub) init() {
4545
}
4646

4747
func (c *PubSub) String() string {
48+
c.mu.Lock()
49+
defer c.mu.Unlock()
50+
4851
channels := mapKeys(c.channels)
4952
channels = append(channels, mapKeys(c.patterns)...)
5053
channels = append(channels, mapKeys(c.schannels)...)

0 commit comments

Comments
 (0)