monitorKeyNotifications sends accumulated notifications to all watchers of respective keys when the given channel ticks.
(ctx context.Context, tickChan <-chan time.Time)
| 1181 | // monitorKeyNotifications sends accumulated notifications to all watchers of |
| 1182 | // respective keys when the given channel ticks. |
| 1183 | func (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. |
| 1199 | func (m *KV) sendKeyNotifications() { |