Skip to content

Commit

Permalink
use write-only mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
ortuman committed Jan 7, 2022
1 parent 5cba44a commit 666b9ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kv/memberlist/memberlist_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ type KV struct {
messageCounter int // Used to give each message in the sentMessages and receivedMessages a unique ID, for UI.

// Per-key value update workers
workersMu sync.RWMutex
workersMu sync.Mutex
workersChannels map[string]chan valueUpdate

// closed on shutdown
Expand Down Expand Up @@ -771,7 +771,7 @@ func (m *KV) notifyWatchers(key string) {
for _, kw := range m.watchers[key] {
select {
case kw <- key:
// notification sent.
// notification sent.
default:
// cannot send notification to this watcher at the moment
// but since this is a buffered channel, it means that
Expand All @@ -784,7 +784,7 @@ func (m *KV) notifyWatchers(key string) {
for _, pw := range ws {
select {
case pw <- key:
// notification sent.
// notification sent.
default:
c, _ := m.watchPrefixDroppedNotifications.GetMetricWithLabelValues(p)
if c != nil {
Expand Down Expand Up @@ -821,7 +821,7 @@ outer:

select {
case <-time.After(noChangeDetectedRetrySleep):
// ok
// ok
case <-ctx.Done():
lastError = ctx.Err()
break outer
Expand Down

0 comments on commit 666b9ab

Please sign in to comment.