Skip to content

Commit c850eb3

Browse files
committed
Fix handling of domserver errors in judgedaemon.
- 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.
1 parent 780c7c9 commit c850eb3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

judge/judgedaemon.main.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ function request(string $url, string $verb = 'GET', $data = '', bool $failonerro
165165
": http status code: " . $status .
166166
", request size = " . strlen(print_r($data, true)) .
167167
", response: " . $response;
168-
if ($status == 500) {
169-
break;
170-
}
171168
} else {
172169
$succeeded = true;
173170
break;
@@ -757,9 +754,12 @@ function fetch_executable_internal(
757754

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

0 commit comments

Comments
 (0)