PTK: Check if theres a scheduled action before logging warning. (#51143)
* Check if there is a scheduled action before logging warning
This commit is contained in:
parent
b618f81c6d
commit
c074c5580b
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Only log PTK error if no action has been scheduled
|
|
@ -141,9 +141,14 @@ class BlockPatterns {
|
|||
|
||||
$patterns = $this->ptk_patterns_store->get_patterns();
|
||||
if ( empty( $patterns ) ) {
|
||||
// By only logging when patterns are empty and no fetch is scheduled,
|
||||
// we ensure that warnings are only generated in genuinely problematic situations,
|
||||
// such as when the pattern fetching mechanism has failed entirely.
|
||||
if ( ! as_has_scheduled_action( 'fetch_patterns' ) ) {
|
||||
wc_get_logger()->warning(
|
||||
__( 'Empty patterns received from the PTK Pattern Store', 'woocommerce' ),
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue