MCPcopy Create free account
hub / github.com/buggregator/server / OnEventStored

Method OnEventStored

modules/smtp/module.go:66–81  ·  view source on GitHub ↗

OnEventStored notifies any long-poll waiters when a new SMTP event arrives.

(ev event.Event)

Source from the content-addressed store, hash-verified

64
65// OnEventStored notifies any long-poll waiters when a new SMTP event arrives.
66func (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.

Callers

nothing calls this directly

Calls 1

matchesFilterFunction · 0.85

Tested by

no test coverage detected