Skip to content

Commit

Permalink
fix(nsqd):concurrency safety
Browse files Browse the repository at this point in the history
  • Loading branch information
gueFDF committed Apr 26, 2023
1 parent 1362af1 commit cfbd287
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nsqd/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,10 @@ func (c *Channel) RemoveClient(clientID int64) {

c.Lock()
delete(c.clients, clientID)
numClients := len(c.clients)
c.Unlock()

if len(c.clients) == 0 && c.ephemeral {
if numClients == 0 && c.ephemeral {
go c.deleter.Do(func() { c.deleteCallback(c) })
}
}
Expand Down

0 comments on commit cfbd287

Please sign in to comment.