// Submit submits a single request
Submit submits a single request
// Submit submits a single request
func (w *worker) Submit(ctx context.Context, req *Request) (<-chan Response, <-chan struct{}) {
	ch := make(chan Response, 1)
	started := make(chan struct{})
	select {
	case w.workCh <- workRequest{
		Request:  req,
		Context:  ctx,
		started:  started,
		resultCh: ch,
	}:
	default:
		close(started)
		ch <- Response{
			RequestID: req.RequestID,
			Error:     fmt.Errorf("worker queue is full"),
		}
	}
	return ch, started
}
func ( w * worker ) Submit ( ctx context . Context , req * Request ) ( <- chan Response , <- chan struct { } ) { ch := make ( chan Response , 1 ) started := make ( chan struct { } ) select { case w . workCh <- workRequest { Request : req , Context : ctx , started : started , resultCh : ch , } : default : close ( started ) ch <- Response { RequestID : req . RequestID , Error : fmt . Errorf ( " " ) , } } return ch , started }
Submit submits a single request
Submit submits a single request