OnEventStored notifies any long-poll waiters when a new SMTP event arrives.
(ev event.Event)
| 64 | |
| 65 | // OnEventStored notifies any long-poll waiters when a new SMTP event arrives. |
| 66 | func (m *Module) OnEventStored(ev event.Event) { |
| 67 | if ev.Type != "smtp" { |
| 68 | return |
| 69 | } |
| 70 | m.mu.Lock() |
| 71 | defer m.mu.Unlock() |
| 72 | for _, w := range m.waiters { |
| 73 | if matchesFilter(ev, w.filter) { |
| 74 | select { |
| 75 | case w.ch <- ev: |
| 76 | default: |
| 77 | // Channel already has an event; waiter will pick it up. |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | // subscribe registers a waiter for the wait endpoint and returns a channel and |
| 84 | // an unsubscribe function. The caller must call unsubscribe when done. |
nothing calls this directly
no test coverage detected