MCPcopy Index your code
hub / github.com/coder/coder / Dispatcher

Method Dispatcher

coderd/notifications/utils_test.go:128–149  ·  view source on GitHub ↗
(payload types.MessagePayload, title, body string, _ template.FuncMap)

Source from the content-addressed store, hash-verified

126}
127
128func (c chanHandler) Dispatcher(payload types.MessagePayload, title, body string, _ template.FuncMap) (dispatch.DeliveryFunc, error) {
129 result := make(chan dispatchResult)
130 call := dispatchCall{
131 payload: payload,
132 title: title,
133 body: body,
134 result: result,
135 }
136 return func(ctx context.Context, _ uuid.UUID) (bool, error) {
137 select {
138 case c.calls <- call:
139 select {
140 case r := <-result:
141 return r.retryable, r.err
142 case <-ctx.Done():
143 return false, ctx.Err()
144 }
145 case <-ctx.Done():
146 return false, ctx.Err()
147 }
148 }, nil
149}
150
151var _ notifications.Handler = &chanHandler{}

Callers

nothing calls this directly

Calls 2

ErrMethod · 0.80
DoneMethod · 0.45

Tested by

no test coverage detected