Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
80 stars 29 forks source link

get_subscriptions_by_gateway() gets called at random times #622

Open paulkirspuu opened 1 month ago

paulkirspuu commented 1 month ago

Describe the bug

We found that WCS_Admin_System_Status::get_subscriptions_by_gateway() gets called at unknown times, affecting database for a couple of minutes with its query SELECT COUNT(subscriptions.ID) as count, post_meta.meta_value as payment_method, subscriptions.post_status FROM wp_posts as subscriptions RIGHT JOIN wp_postmeta as post_meta ON post_meta.post_id = subscriptions.ID WHERE subscriptions.post_type = 'shop_subscription' && post_meta.meta_key = '_payment_method' GROUP BY post_meta.meta_value, subscriptions.post_status.

We're not visiting the System Status page, so yet to understand why this happens.

To Reproduce

Happens at random times.