performance: checks fo $this->data_synchronizer->data_sync_is_enabled… (#46616)

* performance: checks fo $this->data_synchronizer->data_sync_is_enabled() before executing $this->data_synchronizer->get_sync_status()

* Update plugins/woocommerce/src/Internal/Utilities/COTMigrationUtil.php

Fix code style issues

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com>
This commit is contained in:
EngHell 2024-04-18 16:59:18 -06:00 committed by GitHub
parent 48f2a4c5ad
commit 05a728ff03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: performance
Avoid unnecessary query when HPOS compatibility mode is disabled.

View File

@ -74,8 +74,12 @@ class COTMigrationUtil {
* @return bool
*/
public function is_custom_order_tables_in_sync() : bool {
if ( ! $this->data_synchronizer->data_sync_is_enabled() ) {
return false;
}
$sync_status = $this->data_synchronizer->get_sync_status();
return 0 === $sync_status['current_pending_count'] && $this->data_synchronizer->data_sync_is_enabled();
return 0 === $sync_status['current_pending_count'];
}
/**