scheduler: if host reaches daily result quota and contacts the scheduler, tell

it to delay until a random time falling within the first hour of the following
day.  Previously the host would be told to delay one hour, which could lead to
as many as 24 retries in a one-day period.

svn path=/trunk/boinc/; revision=6132
This commit is contained in:
Bruce Allen 2005-05-12 21:04:39 +00:00
parent 4e0c249801
commit 903c361833
2 changed files with 20 additions and 0 deletions

View File

@ -6458,9 +6458,15 @@ David 11 May 2005
Bruce 12 May 2005 Bruce 12 May 2005
- forums: allow project admin, project developers and forum moderators to edit - forums: allow project admin, project developers and forum moderators to edit
their own posts at any time (not just within one hour). their own posts at any time (not just within one hour).
- scheduler: if host reaches daily result quota and contacts the scheduler, tell
it to delay until a random time falling within the first hour of the following
day. Previously the host would be told to delay one hour, which could lead to
as many as 24 retries in a one-day period.
html/ html/
user/ user/
forum_edit.php forum_edit.php
sched/
sched_send.C

View File

@ -972,6 +972,9 @@ int send_work(
} }
if (reply.wreq.daily_result_quota_exceeded) { if (reply.wreq.daily_result_quota_exceeded) {
char helpful[256]; char helpful[256];
struct tm *rpc_time_tm;
int delay_time;
sprintf(helpful, "(reached daily quota of %d results)", reply.wreq.daily_result_quota); sprintf(helpful, "(reached daily quota of %d results)", reply.wreq.daily_result_quota);
USER_MESSAGE um(helpful, "high"); USER_MESSAGE um(helpful, "high");
reply.insert_message(um); reply.insert_message(um);
@ -980,6 +983,17 @@ int send_work(
"Daily result quota exceeded for host %d\n", "Daily result quota exceeded for host %d\n",
reply.host.id reply.host.id
); );
// set delay so host won't return until a random time in
// the first hour of 'the next day'. This is to prevent a
// lot of hosts from flooding the scheduler with requests
// at the same time of day.
rpc_time_tm = localtime((const time_t*)&reply.host.rpc_time);
delay_time = (23 - rpc_time_tm->tm_hour) * 3600 +
(59 - rpc_time_tm->tm_min) * 60 +
(60 - rpc_time_tm->tm_sec) +
(int)(3600*(double)rand()/(double)RAND_MAX);
reply.set_delay(delay_time);
} }
} }
return 0; return 0;