Skip to content

Commit

Permalink
Fix handling of domserver errors in judgedaemon.
Browse files Browse the repository at this point in the history
- Treat 500 / internal server error as retry-able
- If we still fail after all configured retries, we do mark the endpoint
  as errored and sleep for a while longer. Afterwards, we are
  registering ourselves again and if that succeeds will try to fetch work
  again.
  • Loading branch information
meisterT committed Nov 23, 2024
1 parent 780c7c9 commit c850eb3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions judge/judgedaemon.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@ function request(string $url, string $verb = 'GET', $data = '', bool $failonerro
": http status code: " . $status .
", request size = " . strlen(print_r($data, true)) .
", response: " . $response;
if ($status == 500) {
break;
}
} else {
$succeeded = true;
break;
Expand Down Expand Up @@ -757,9 +754,12 @@ function fetch_executable_internal(

// Request open submissions to judge. Any errors will be treated as
// non-fatal: we will just keep on retrying in this loop.
$row = [];
$judging = request('judgehosts/fetch-work', 'POST', ['hostname' => $myhost], false);
// If $judging is null, an error occurred; don't try to decode.
if (!is_null($judging)) {
// If $judging is null, an error occurred; we marked the endpoint already as errorred above.
if (is_null($judging)) {
continue;
} else {
$row = dj_json_decode($judging);
}

Expand Down

0 comments on commit c850eb3

Please sign in to comment.