andrewpro
Forum Replies Created
-
HI Gregor,
thanks for the answers once again. You are of course right about the fact that this query is not very expensive in many cases, but unfortunately in my specific case, the page itself and the number of queries that are generated to the database are unacceptable. I already know, as you mentioned, that it is not related to WooComerce itself, but only to the AS mechanism that you used, so my suggestion would be to fork this dependency where you can safely remove this query. I know WP does the cache you mentioned, but this query to the database is executed every time I display a post on my site and it always returns null because there is no such entry in my case and therefore it is executed every time. I can change it myself, but with each subsequent update my change will be overwritten by you. Elsewhere, a different AS mechanism dedicated to the given plugin will be used, so it will not have a negative impact on other AS tasks.Have a nice day!
@capuderg Find this https://github.com/woocommerce/action-scheduler/blob/master/classes/abstracts/ActionScheduler.php#L180
This is needed for WooComerce but not necessarily for your plugin in my opinion
Take care!
Hi Gregor,
Actually my mistake. I’m very sorry! But the mentioned query is not completely needed in my case, and only generates unnecessary queries. Unfortunately, I have a big problem with almost 400 queries to the database each time I view the page(in this case, every query matters). In my case and in many other people it is probably unnecessary. It runs because you are using the AS class with WooCommerce in your plugin, and there apparently this is some default behavior for that plugin.
Thank you!
@capuderg
Thank you for your answer. I know this and as you mention it is exactly about this query:SELECT option_value FROM wp_options WHERE option_name = 'as_has_wp_comment_logs' LIMIT 1The way Action Scheduler works is, it will load the latest version it can find from all the plugins that are using it and load that version. Our plugin is using the latest version of AS and that’s why it looks like everything AS related is loading from our plugin…
I didn’t know about it, but it’s the only AS job in my configuration then.
I have also verified and I do not have an entry for
as_has_wp_comment_logsin thewp_optionstable, and yet the cron is still running and doing this task in the background all the time.
Update
Execution stack trace:
wp-includes/option.php:124 ActionScheduler_WPCommentCleaner::has_logs() wp-content/plugins/wp-mail-smtp/vendor/woocommerce/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php:61 ActionScheduler::init() wp-content/plugins/wp-mail-smtp/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler.php:180 action_scheduler_initialize_3_dot_1_dot_6() wp-content/plugins/wp-mail-smtp/vendor/woocommerce/action-scheduler/action-scheduler.php:44 WPMailSMTP\Core->load_action_scheduler() wp-content/plugins/wp-mail-smtp/src/Core.php:787 do_action('plugins_loaded') wp-includes/plugin.php:478That’s why I contacted you with this problem.
Thank you!
- This reply was modified 5 years, 3 months ago by andrewpro.
@capuderg
Answer transferred for another post Can We Disable Action Scheduler? for clear.
Have a nice day!@capuderg
Thank you for your answer. At the moment I only use the Lite version. I also know the risk of removing Action Scheduler for other plugins, but I noticed that when analyzing queries in Query monitor, your plugin performs queries scheduled by functions load_action_scheduler which starts the Action Scheduler for ActionScheduler_WPCommentCleaner, after introducing Action Scheduler in v2.1 of your plugin. That’s why I asked if I can turn off this scheduled task if I don’t have WooCommerce and comments on the website?@capuderg
Hello, I encountered a similar problem during optalization. I would like to ask for what purpose this plugin uses the mentioned cron when generating posts on my site. I do not have WooCommerce or comments on my site and could I safely disable this task in this case?