You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a pattern that's a bit hard to understand:
cm.channelsMutex.Lock()
channel, exists = cm.channels[name]
cm.channelsMutex.Unlock()
if !exists {
// Ensure we update our cache of known channels
cm.channelsMutex.Lock()
defer cm.channelsMutex.Unlock()
channel, exists = cm.channels[name]
if exists {
return channel, nil
}
channel, err = cm.newChannel(name)
if err != nil {
return nil, err
}
cm.channels[name] = channel
}```
What is the work of the second `cm.channels[name]` if the first has exists false?
NB: getChannel function inside channel_manager.go file
The text was updated successfully, but these errors were encountered:
I noticed a pattern that's a bit hard to understand:
The text was updated successfully, but these errors were encountered: