Merge pull request #77 from yaohcn/timeout-ctx

add RPC timeout
This commit is contained in:
Łukasz Magiera 2020-07-23 22:09:50 +02:00 committed by GitHub
commit ed2e57dde6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -258,7 +258,9 @@ func (sh *scheduler) trySched() {
continue continue
} }
ok, err := task.sel.Ok(task.ctx, task.taskType, sh.spt, worker) rpcCtx, cancel := context.WithTimeout(task.ctx, SelectorTimeout)
ok, err := task.sel.Ok(rpcCtx, task.taskType, sh.spt, worker)
cancel()
if err != nil { if err != nil {
log.Errorf("trySched(1) req.sel.Ok error: %+v", err) log.Errorf("trySched(1) req.sel.Ok error: %+v", err)
continue continue