From 921e387f42b3dc1f27d31f5e5710738c0ea66cd9 Mon Sep 17 00:00:00 2001 From: Collins Agbonghama Date: Tue, 16 Jun 2026 13:07:37 +0100 Subject: [PATCH 1/2] Skip calling sleep() if function argument is zero --- classes/wp-background-process.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/wp-background-process.php b/classes/wp-background-process.php index 2760b21..8f496c9 100644 --- a/classes/wp-background-process.php +++ b/classes/wp-background-process.php @@ -633,8 +633,10 @@ protected function handle() { $this->update( $batch->key, $batch->data ); } - // Let the server breathe a little. - sleep( $throttle_seconds ); + if ( $throttle_seconds !== 0 ) { + // Let the server breathe a little. + sleep( $throttle_seconds ); + } // Batch limits reached, or pause or cancel requested. if ( ! $this->should_continue() ) { From 1ada8b78ec7e6f082ddff0b6063c790534bd98a7 Mon Sep 17 00:00:00 2001 From: Collins Agbonghama Date: Tue, 16 Jun 2026 13:17:23 +0100 Subject: [PATCH 2/2] Update wp-background-process.php --- classes/wp-background-process.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/wp-background-process.php b/classes/wp-background-process.php index 8f496c9..71fcd14 100644 --- a/classes/wp-background-process.php +++ b/classes/wp-background-process.php @@ -633,7 +633,7 @@ protected function handle() { $this->update( $batch->key, $batch->data ); } - if ( $throttle_seconds !== 0 ) { + if ( $throttle_seconds > 0 ) { // Let the server breathe a little. sleep( $throttle_seconds ); }