notifySubscribers sends a non-blocking signal to all subscriber channels for the given chat IDs.
(chatIDs []uuid.UUID)
| 70 | // notifySubscribers sends a non-blocking signal to all subscriber |
| 71 | // channels for the given chat IDs. |
| 72 | func (ps *PathStore) notifySubscribers(chatIDs []uuid.UUID) { |
| 73 | ps.mu.RLock() |
| 74 | toNotify := make([]chan<- struct{}, 0) |
| 75 | for _, id := range chatIDs { |
| 76 | toNotify = append(toNotify, ps.subscribers[id]...) |
| 77 | } |
| 78 | ps.mu.RUnlock() |
| 79 | |
| 80 | for _, ch := range toNotify { |
| 81 | select { |
| 82 | case ch <- struct{}{}: |
| 83 | default: |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | // GetPaths returns all paths tracked for a chat, deduplicated |
| 89 | // and sorted lexicographically. |