client: fix bug that sometimes prevented work fetch when CPU throttling in use

This commit is contained in:
David Anderson 2013-06-13 20:50:21 -07:00
parent 0e6a081cc7
commit 1e106d6fd7
1 changed files with 21 additions and 15 deletions

View File

@ -484,26 +484,32 @@ bool CLIENT_STATE::scheduler_rpc_poll() {
return true;
}
// check if we should fetch work.
// check if we should fetch work (do this last)
//
if (!tasks_suspended
&& !(config.fetch_minimal_work && had_or_requested_work)
) {
switch (suspend_reason) {
case 0:
case SUSPEND_REASON_CPU_THROTTLE:
break;
default:
return false;
}
if (config.fetch_minimal_work && had_or_requested_work) {
return false;
}
p = work_fetch.choose_project();
if (p) {
if (actively_uploading(p)) {
if (log_flags.work_fetch_debug) {
msg_printf(p, MSG_INFO,
"[work_fetch] deferring work fetch; upload active"
);
}
return false;
p = work_fetch.choose_project();
if (p) {
if (actively_uploading(p)) {
if (log_flags.work_fetch_debug) {
msg_printf(p, MSG_INFO,
"[work_fetch] deferring work fetch; upload active"
);
}
scheduler_op->init_op_project(p, RPC_REASON_NEED_WORK);
return true;
return false;
}
scheduler_op->init_op_project(p, RPC_REASON_NEED_WORK);
return true;
}
return false;
}