Skip to content

Commit 1c2fb1a

Browse files
authored
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.
1 parent 4466b59 commit 1c2fb1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

woocommerce/utilities/class-sv-wp-background-job-handler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,11 @@ protected function is_queue_empty() {
203203
$processing = '%"status":"processing"%';
204204

205205
$count = $wpdb->get_var( $wpdb->prepare( "
206-
SELECT COUNT(*)
206+
SELECT COUNT(option_id)
207207
FROM {$wpdb->options}
208208
WHERE option_name LIKE %s
209209
AND ( option_value LIKE %s OR option_value LIKE %s )
210+
LIMIT 1
210211
", $key, $queued, $processing ) );
211212

212213
return ( $count > 0 ) ? false : true;

0 commit comments

Comments
 (0)