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 ) {
@@ -785,8 +786,19 @@ function fetch_executable_internal(
785
786
786
787
// We have gotten a work packet.
787
788
$ endpoints [$ endpointID ]["waiting " ] = false ;
789
+
788
790
// All tasks are guaranteed to be of the same type.
789
791
$ type = $ row [0 ]['type ' ];
792
+
793
+ if ($ type == 'try_again ' ) {
794
+ if (!$ endpoints [$ endpointID ]['retrying ' ]) {
795
+ logmsg (LOG_INFO , "API indicated to retry fetching work (this might take a while to clean up). " );
796
+ }
797
+ $ endpoints [$ endpointID ]['retrying ' ] = true ;
798
+ continue ;
799
+ }
800
+ $ endpoints [$ endpointID ]['retrying ' ] = false ;
801
+
790
802
logmsg (LOG_INFO ,
791
803
"⇝ Received " . sizeof ($ row ) . " ' " . $ type . "' judge tasks (endpoint $ endpointID) " );
792
804
Original file line number Diff line number Diff line change @@ -1611,8 +1611,16 @@ public function getJudgeTasksAction(Request $request): array
1611
1611
->setMaxResults (1 )
1612
1612
->getQuery ()
1613
1613
->getOneOrNullResult (AbstractQuery::HYDRATE_SINGLE_SCALAR );
1614
+ if ($ jobid === null ) {
1615
+ return ;
1616
+ }
1614
1617
$ judgetasks = $ this ->getJudgetasks ($ jobid , $ max_batchsize , $ judgehost );
1615
- if ($ judgetasks !== null ) {
1618
+ if (empty ($ judgetasks )) {
1619
+ // Somehow we got ourselves in a situation that there was a queue task without remaining judge tasks.
1620
+ // This should not happen, but if it does, we need to clean up. Each of the fetch-work calls will clean
1621
+ // up one queue task. We need to signal to the judgehost that there might be more work to do.
1622
+ $ judgetasks = [['type ' => 'try_again ' ]];
1623
+ } else {
1616
1624
// Mark it as being worked on.
1617
1625
$ this ->em ->createQueryBuilder ()
1618
1626
->update (QueueTask::class, 'qt ' )
You can’t perform that action at this time.
0 commit comments