From 1c2fb1a31228f754ef7427f15ac034d3d8cb6de0 Mon Sep 17 00:00:00 2001 From: Ramon Fincken Date: Thu, 21 Mar 2024 11:27:02 +0100 Subject: [PATCH] Update class-sv-wp-background-job-handler.php Make this more efficient. While awaiting a dedicated database table where no LIKE queries ever will be needed. --- woocommerce/utilities/class-sv-wp-background-job-handler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/woocommerce/utilities/class-sv-wp-background-job-handler.php b/woocommerce/utilities/class-sv-wp-background-job-handler.php index e9ec8b88a..6e106ed27 100644 --- a/woocommerce/utilities/class-sv-wp-background-job-handler.php +++ b/woocommerce/utilities/class-sv-wp-background-job-handler.php @@ -203,10 +203,11 @@ protected function is_queue_empty() { $processing = '%"status":"processing"%'; $count = $wpdb->get_var( $wpdb->prepare( " - SELECT COUNT(*) + SELECT COUNT(option_id) FROM {$wpdb->options} WHERE option_name LIKE %s AND ( option_value LIKE %s OR option_value LIKE %s ) + LIMIT 1 ", $key, $queued, $processing ) ); return ( $count > 0 ) ? false : true;