diff --git a/checkin_notes b/checkin_notes index 2b8d4f7c37..0aa2893e9f 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4648,3 +4648,13 @@ David 25 Jun 2010 sched/ handle_request.cpp + +David 25 Jun 2010 + - scheduler: host_app_version.n_jobs_today was being cleared + only if the previous request was on a different day + AND the current request asks for work. + Sometimes it wasn't getting cleared when it should have. + + sched/ + sched_send.cpp,h + handle_request.cpp diff --git a/sched/handle_request.cpp b/sched/handle_request.cpp index 0bf2360a0d..e6a960e37b 100644 --- a/sched/handle_request.cpp +++ b/sched/handle_request.cpp @@ -1229,6 +1229,7 @@ void process_request(char* code_sign_key) { handle_global_prefs(); read_host_app_versions(); + update_n_jobs_today(); handle_results(); diff --git a/sched/sched_send.cpp b/sched/sched_send.cpp index 71fa5897f6..e2ade5e786 100644 --- a/sched/sched_send.cpp +++ b/sched/sched_send.cpp @@ -409,14 +409,23 @@ static void update_quota(DB_HOST_APP_VERSION& hav) { } if (g_request->last_rpc_dayofyear != g_request->current_rpc_dayofyear) { - log_messages.printf(MSG_DEBUG, - "[HOST#%d] [HAV#%d] Resetting njobs_today\n", - g_reply->host.id, hav.app_version_id - ); + if (config.debug_quota) { + log_messages.printf(MSG_INFO, + "[quota] [HOST#%d] [HAV#%d] Resetting n_jobs_today\n", + g_reply->host.id, hav.app_version_id + ); + } hav.n_jobs_today = 0; } } +void update_n_jobs_today() { + for (unsigned int i=0; ihost_app_versions.size(); i++) { + DB_HOST_APP_VERSION& hav = g_wreq->host_app_versions[i]; + update_quota(hav); + } +} + static void get_reliability_and_trust() { // Platforms other than Windows, Linux and Intel Macs need a // larger set of computers to be marked reliable @@ -436,7 +445,6 @@ static void get_reliability_and_trust() { DB_HOST_APP_VERSION& hav = g_wreq->host_app_versions[i]; get_reliability_version(hav, multiplier); set_trust(hav); - update_quota(hav); } } diff --git a/sched/sched_send.h b/sched/sched_send.h index 561c5729e7..fea5db85a6 100644 --- a/sched/sched_send.h +++ b/sched/sched_send.h @@ -71,5 +71,6 @@ extern bool work_needed(bool); extern void send_work_setup(); extern int effective_ncpus(); extern int preferred_app_message_index; +extern void update_n_jobs_today(); #endif