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

Method monitorKeyNotifications

kv/memberlist/memberlist_client.go:1183–1196  ·  view source on GitHub ↗

monitorKeyNotifications sends accumulated notifications to all watchers of respective keys when the given channel ticks.

(ctx context.Context, tickChan <-chan time.Time)

Source from the content-addressed store, hash-verified

1181// monitorKeyNotifications sends accumulated notifications to all watchers of
1182// respective keys when the given channel ticks.
1183func (m *KV) monitorKeyNotifications(ctx context.Context, tickChan <-chan time.Time) {
1184 if m.cfg.NotifyInterval <= 0 {
1185 panic("sendNotifications called with NotifyInterval <= 0")
1186 }
1187
1188 for {
1189 select {
1190 case <-tickChan:
1191 m.sendKeyNotifications()
1192 case <-ctx.Done():
1193 return
1194 }
1195 }
1196}
1197
1198// sendKeyNotifications sends accumulated notifications to watchers of respective keys.
1199func (m *KV) sendKeyNotifications() {

Callers 2

TestNotificationDelayFunction · 0.95
runningMethod · 0.95

Calls 2

sendKeyNotificationsMethod · 0.95
DoneMethod · 0.65

Tested by 1

TestNotificationDelayFunction · 0.76