SendError sends an error to the asyncResponse. This will cause the asyncResponse to return the error on the next call to Next. we send on a channel to give errors the chance to unblock the select below. we also store in an atomic error so that a Responses in error will always remain in error
(err error)
| 121 | // we send on a channel to give errors the chance to unblock the select below. we also store in an atomic error so that |
| 122 | // a Responses in error will always remain in error |
| 123 | func (a *asyncResponse) SendError(err error) { |
| 124 | select { |
| 125 | case a.errChan <- err: |
| 126 | a.err.Store(err) |
| 127 | default: |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | // SendComplete indicates the sender is done. We close the channel to give a clear signal to the consumer |
| 132 | func (a *asyncResponse) SendComplete() { |