MCPcopy
hub / github.com/grafana/dskit / notifyWatchers

Method notifyWatchers

kv/memberlist/memberlist_client.go:1170–1179  ·  view source on GitHub ↗

notifyWatchers sends notification to all watchers of given key. If delay is enabled, it accumulates them for later sending.

(key string)

Source from the content-addressed store, hash-verified

1168// notifyWatchers sends notification to all watchers of given key. If delay is
1169// enabled, it accumulates them for later sending.
1170func (m *KV) notifyWatchers(key string) {
1171 if m.cfg.NotifyInterval <= 0 {
1172 m.notifyWatchersSync(key)
1173 return
1174 }
1175
1176 m.notifMu.Lock()
1177 defer m.notifMu.Unlock()
1178 m.keyNotifications[key] = struct{}{}
1179}
1180
1181// monitorKeyNotifications sends accumulated notifications to all watchers of
1182// respective keys when the given channel ticks.

Callers 5

TestNotificationDelayFunction · 0.95
DeleteMethod · 0.95
CASMethod · 0.95
processValueUpdateMethod · 0.95
MergeRemoteStateMethod · 0.95

Calls 1

notifyWatchersSyncMethod · 0.95

Tested by 1

TestNotificationDelayFunction · 0.76