+ while ( true ) {
+ $response = $runner->run( [
+ 'type' => $type,
+ 'maxJobs' => $maxJobs,
+ 'maxTime' => $maxTime,
+ 'throttle' => $throttle,
+ ] );
+
+ if ( $outputJSON ) {
+ $this->output( FormatJson::encode( $response, true ) );
+ }
+
+ if (
+ !$wait ||
+ $response['reached'] === 'time-limit' ||
+ $response['reached'] === 'job-limit' ||
+ $response['reached'] === 'memory-limit'
+ ) {
+ break;
+ }
+
+ if ( $maxJobs !== false ) {
+ $maxJobs -= count( $response['jobs'] );
+ }
+
+ sleep( 1 );