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
6060 "waiting " => false ,
6161 "errorred " => false ,
6262 "last_attempt " => -1 ,
63+ "retrying " => false ,
6364 ];
6465 }
6566 if (count ($ endpoints ) <= 0 ) {
@@ -784,8 +785,19 @@ function fetch_executable_internal(
784785
785786 // We have gotten a work packet.
786787 $ endpoints [$ endpointID ]["waiting " ] = false ;
788+
787789 // All tasks are guaranteed to be of the same type.
788790 $ type = $ row [0 ]['type ' ];
791+
792+ if ($ type == 'try_again ' ) {
793+ if (!$ endpoints [$ endpointID ]['retrying ' ]) {
794+ logmsg (LOG_INFO , "API indicated to retry fetching work (this might take a while to clean up). " );
795+ }
796+ $ endpoints [$ endpointID ]['retrying ' ] = true ;
797+ continue ;
798+ }
799+ $ endpoints [$ endpointID ]['retrying ' ] = false ;
800+
789801 logmsg (LOG_INFO ,
790802 "⇝ Received " . sizeof ($ row ) . " ' " . $ type . "' judge tasks (endpoint $ endpointID) " );
791803
Original file line number Diff line number Diff line change @@ -1594,8 +1594,16 @@ public function getJudgeTasksAction(Request $request): array
15941594 ->setMaxResults (1 )
15951595 ->getQuery ()
15961596 ->getOneOrNullResult (AbstractQuery::HYDRATE_SINGLE_SCALAR );
1597+ if ($ jobid === null ) {
1598+ return ;
1599+ }
15971600 $ 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 {
15991607 // Mark it as being worked on.
16001608 $ this ->em ->createQueryBuilder ()
16011609 ->update (QueueTask::class, 'qt ' )
You can’t perform that action at this time.
0 commit comments