File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ public function is_running() {
190190 * @return array
191191 */
192192 public function get_queue_status () {
193- $ queue = $ this ->get_queue ();
193+ $ queue = $ this ->validate_queue ();
194194 $ pending = 0 ;
195195 foreach ( $ this ->threads as $ thread ) {
196196 $ pending += count ( $ queue [ $ thread ] );
@@ -234,6 +234,8 @@ public function get_queue_status() {
234234
235235 /**
236236 * Validate the queue is up to date and populate with unsynced assets.
237+ *
238+ * @return array Validated Queue.
237239 */
238240 public function validate_queue () {
239241
@@ -281,10 +283,16 @@ public function validate_queue() {
281283 $ chunks = array_chunk ( $ ids , $ chunk_size );
282284 foreach ( $ chunks as $ index => $ chunk ) {
283285 $ queue [ $ this ->threads [ $ index ] ] = $ chunk ;
286+ // Check thread is still running.
287+ if ( $ this ->is_running () && ! $ this ->thread_running ( $ this ->threads [ $ index ] ) ) {
288+ $ this ->start_thread ( $ this ->threads [ $ index ] );
289+ }
284290 }
285291 }
286292
287293 $ this ->set_queue ( $ queue );
294+
295+ return $ queue ;
288296 }
289297
290298 /**
You can’t perform that action at this time.
0 commit comments