acquireWorker acquires the processing worker
()
| 29 | |
| 30 | // acquireWorker acquires the processing worker |
| 31 | func (r *request) acquireWorker() (context.CancelFunc, errctx.Error) { |
| 32 | ctx, cancelSpan := r.Monitoring().StartSpan(r.req.Context(), "Queue", nil) |
| 33 | defer cancelSpan() |
| 34 | |
| 35 | fn, err := r.Workers().Acquire(ctx) |
| 36 | if err != nil { |
| 37 | // We don't actually need to check timeout here, |
| 38 | // but it's an easy way to check if this is an actual timeout |
| 39 | // or the request was canceled |
| 40 | if terr := server.CheckTimeout(ctx); terr != nil { |
| 41 | return nil, terr |
| 42 | } |
| 43 | |
| 44 | // We should never reach this line as err could be only ctx.Err() |
| 45 | // and we've already checked for it. But beter safe than sorry |
| 46 | return nil, errctx.Wrap(err) |
| 47 | } |
| 48 | |
| 49 | return fn, nil |
| 50 | } |
| 51 | |
| 52 | // makeDownloadOptions creates a new default download options |
| 53 | func (r *request) makeDownloadOptions( |
no test coverage detected