Skip to content

Commit cb2cfb0

Browse files
fukua95ndyakov
authored andcommitted
fix: PubSub isn't concurrency-safe (#3360)
1 parent 46d4b20 commit cb2cfb0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pubsub.go

+3
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)