Skip to content

Commit 9b03ea1

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. (cherry picked from commit c850eb3)
1 parent 121276b commit 9b03ea1

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
@@ -164,9 +164,6 @@ function request(string $url, string $verb = 'GET', $data = '', bool $failonerro
164164
": http status code: " . $status .
165165
", request size = " . strlen(print_r($data, true)) .
166166
", response: " . $response;
167-
if ($status == 500) {
168-
break;
169-
}
170167
} else {
171168
$succeeded = true;
172169
break;
@@ -751,9 +748,12 @@ function fetch_executable_internal(
751748

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

0 commit comments

Comments
 (0)