From 57c04979b348355fe33ad2cb9152b266869c362b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 7 Oct 2011 21:20:42 +0000 Subject: [PATCH] - client: don't do scheduler-requested RPCs if - project is set to No New Work, and - project has no jobs on the client svn path=/trunk/boinc/; revision=24348 --- checkin_notes | 10 ++++++++++ client/client_types.h | 1 + client/cs_scheduler.cpp | 9 ++++++++- client/work_fetch.cpp | 16 ++++++++++++---- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index 662b9905cf..ba59cddc03 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6935,3 +6935,13 @@ David 7 Oct 2011 client/ app_start.cpp + +David 7 Oct 2011 + - client: don't do scheduler-requested RPCs if + - project is set to No New Work, and + - project has no jobs on the client + + client/ + client_types.h + work_fetch.cpp + cs_scheduler.cpp diff --git a/client/client_types.h b/client/client_types.h index 12c3f26be1..efa6bb4393 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -422,6 +422,7 @@ struct PROJECT : PROJ_AM { // don't request work from a project if an upload started // in last X minutes and is still active bool uploading(); + bool has_results(); struct RESULT *next_runnable_result; // the next result to run for this project diff --git a/client/cs_scheduler.cpp b/client/cs_scheduler.cpp index fe0b0a46ef..1113c7dca8 100644 --- a/client/cs_scheduler.cpp +++ b/client/cs_scheduler.cpp @@ -1095,8 +1095,15 @@ PROJECT* CLIENT_STATE::next_project_sched_rpc_pending() { bool honor_backoff = true; bool honor_suspend = true; + // is a scheduler-requested RPC due? + // if (!p->sched_rpc_pending && p->next_rpc_time && p->next_rpc_timesched_rpc_pending = RPC_REASON_PROJECT_REQ; + // don't do it if project is set to no new work + // and has no jobs currently + // + if (!p->dont_request_more_work || p->has_results()) { + p->sched_rpc_pending = RPC_REASON_PROJECT_REQ; + } } switch (p->sched_rpc_pending) { diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index c754c282ac..48d4780b59 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -915,13 +915,21 @@ bool PROJECT::downloading() { return false; } +bool PROJECT::has_results() { + for (unsigned i=0; iproject == this) return true; + } + return false; +} + bool PROJECT::some_result_suspended() { unsigned int i; for (i=0; iproject != this) continue; - if (rp->suspended_via_gui) return true; - } + RESULT *rp = gstate.results[i]; + if (rp->project != this) continue; + if (rp->suspended_via_gui) return true; + } return false; }