@@ -96,6 +96,33 @@ protected function execute(InputInterface $input, OutputInterface $output)
9696 return \Magento \Framework \Console \Cli::RETURN_FAILURE ;
9797 }
9898
99+ $ returnCode = $ this ->executeJobsFromQueue ();
100+ if ($ returnCode != \Magento \Framework \Console \Cli::RETURN_SUCCESS ) {
101+ $ output ->writeln ($ notification );
102+ }
103+
104+ return $ returnCode ;
105+ }
106+
107+ /**
108+ * Check if Cron job can be run
109+ *
110+ * @return bool
111+ */
112+ private function checkRun ()
113+ {
114+ return $ this ->readinessCheck ->runReadinessCheck ()
115+ && !$ this ->status ->isUpdateInProgress ()
116+ && !$ this ->status ->isUpdateError ();
117+ }
118+
119+ /**
120+ * Executes setup jobs from the queue
121+ *
122+ * @return int
123+ */
124+ private function executeJobsFromQueue ()
125+ {
99126 $ returnCode = \Magento \Framework \Console \Cli::RETURN_SUCCESS ;
100127 try {
101128 while (!empty ($ this ->queue ->peek ()) && strpos ($ this ->queue ->peek ()[Queue::KEY_JOB_NAME ], 'setup: ' ) === 0 ) {
@@ -125,29 +152,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
125152 $ returnCode = \Magento \Framework \Console \Cli::RETURN_FAILURE ;
126153 } finally {
127154 $ this ->status ->toggleUpdateInProgress (false );
128- if ($ returnCode != \Magento \Framework \Console \Cli::RETURN_SUCCESS ) {
129- $ output ->writeln ($ notification );
130- }
131- return $ returnCode ;
132- }
133-
134- if ($ this ->status ->isUpdateError ()) {
135- // we must have an exit code higher than zero to indicate something was wrong
136- return \Magento \Framework \Console \Cli::RETURN_FAILURE ;
137155 }
138-
139- return \Magento \Framework \Console \Cli::RETURN_SUCCESS ;
140- }
141-
142- /**
143- * Check if Cron job can be run
144- *
145- * @return bool
146- */
147- private function checkRun ()
148- {
149- return $ this ->readinessCheck ->runReadinessCheck ()
150- && !$ this ->status ->isUpdateInProgress ()
151- && !$ this ->status ->isUpdateError ();
156+ return $ returnCode ;
152157 }
153158}
0 commit comments