Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions judge/judgedaemon.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,12 @@ function fetch_executable_internal(
$new_judging_run = (array) dj_json_decode(base64_decode(file_get_contents($options['j'])));
$judgeTaskId = $options['t'];

$success = false;
for ($i = 0; $i < 5; $i++) {
if ($i > 0) {
$sleep_ms = 100 + random_int(200, ($i+1)*1000);
dj_sleep(0.001 * $sleep_ms);
}
$response = request(
sprintf('judgehosts/add-judging-run/%s/%s', $new_judging_run['hostname'],
urlencode((string)$judgeTaskId)),
Expand All @@ -636,11 +641,13 @@ function fetch_executable_internal(
);
if ($response !== null) {
logmsg(LOG_DEBUG, "Adding judging run result for jt$judgeTaskId successful.");
$success = true;
break;
}
logmsg(LOG_WARNING, "Failed to report $judgeTaskId in attempt #" . ($i + 1) . ".");
$sleep_ms = 100 + random_int(200, ($i+1)*1000);
dj_sleep(0.001 * $sleep_ms);
logmsg(LOG_WARNING, "Failed to report jt$judgeTaskId in attempt #" . ($i + 1) . ".");
}
if (!$success) {
error("Final attempt of uploading jt$judgeTaskId was unsuccessful, giving up.");
}
unlink($options['j']);
exit(0);
Expand Down
Loading