File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
webapp/src/Controller/API Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ function read_credentials(): void
60
60
"waiting " => false ,
61
61
"errorred " => false ,
62
62
"last_attempt " => -1 ,
63
+ "retrying " => false ,
63
64
];
64
65
}
65
66
if (count ($ endpoints ) <= 0 ) {
@@ -780,8 +781,19 @@ function fetch_executable_internal(
780
781
781
782
// We have gotten a work packet.
782
783
$ endpoints [$ endpointID ]["waiting " ] = false ;
784
+
783
785
// All tasks are guaranteed to be of the same type.
784
786
$ type = $ row [0 ]['type ' ];
787
+
788
+ if ($ type == 'try_again ' ) {
789
+ if (!$ endpoints [$ endpointID ]['retrying ' ]) {
790
+ logmsg (LOG_INFO , "API indicated to retry fetching work (this might take a while to clean up). " );
791
+ }
792
+ $ endpoints [$ endpointID ]['retrying ' ] = true ;
793
+ continue ;
794
+ }
795
+ $ endpoints [$ endpointID ]['retrying ' ] = false ;
796
+
785
797
logmsg (LOG_INFO ,
786
798
"⇝ Received " . sizeof ($ row ) . " ' " . $ type . "' judge tasks (endpoint $ endpointID) " );
787
799
Original file line number Diff line number Diff line change @@ -1594,8 +1594,16 @@ public function getJudgeTasksAction(Request $request): array
1594
1594
->setMaxResults (1 )
1595
1595
->getQuery ()
1596
1596
->getOneOrNullResult (AbstractQuery::HYDRATE_SINGLE_SCALAR );
1597
+ if ($ jobid === null ) {
1598
+ return ;
1599
+ }
1597
1600
$ judgetasks = $ this ->getJudgetasks ($ jobid , $ max_batchsize , $ judgehost );
1598
- if ($ judgetasks !== null ) {
1601
+ if (empty ($ judgetasks )) {
1602
+ // Somehow we got ourselves in a situation that there was a queue task without remaining judge tasks.
1603
+ // This should not happen, but if it does, we need to clean up. Each of the fetch-work calls will clean
1604
+ // up one queue task. We need to signal to the judgehost that there might be more work to do.
1605
+ $ judgetasks = [['type ' => 'try_again ' ]];
1606
+ } else {
1599
1607
// Mark it as being worked on.
1600
1608
$ this ->em ->createQueryBuilder ()
1601
1609
->update (QueueTask::class, 'qt ' )
You can’t perform that action at this time.
0 commit comments