File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -391,16 +391,20 @@ public function run_queue( WP_REST_Request $request ) {
391391 $ this ->init_time = (int ) $ request ->get_param ( 'time ' );
392392 $ queue = $ this ->locker ->get_lock_file ( $ this ->init_time );
393393 register_shutdown_function ( array ( $ this , 'cleanup_failed_cron ' ) );
394- foreach ( $ queue as $ name ) {
395- if ( ! isset ( $ this ->processes [ $ name ] ) ) {
396- continue ;
397- }
398- $ process = $ this ->processes [ $ name ];
399- $ data = $ process ['callback ' ]( $ name );
400- // @todo: Log data result.
401394
402- $ this ->unlock_schedule_process ( $ name );
395+ if ( ! empty ( $ queue ) ) {
396+ foreach ( $ queue as $ name ) {
397+ if ( ! isset ( $ this ->processes [ $ name ] ) ) {
398+ continue ;
399+ }
400+ $ process = $ this ->processes [ $ name ];
401+ $ data = $ process ['callback ' ]( $ name );
402+ // @todo: Log data result.
403+
404+ $ this ->unlock_schedule_process ( $ name );
405+ }
403406 }
407+
404408 $ this ->locker ->delete_lock_file ( $ this ->init_time );
405409 }
406410
You can’t perform that action at this time.
0 commit comments