Closed lkraav closed 2 years ago
Hi @lkraav,
as you can see we are using the Action Scheduler library in our plugin. This library uses the default WPCron to fire its background tasks. WPCron is run on page requests (frontend or backend), that's just how it works. If you want to resolve this issue, the best option is to disable WPCron and configure a real Cron job on your server which will processes these background tasks. Here is an article on how to do that.
Have a nice day!
I am running a server cron, hence my interest into why frontend requests are being spammed with AS action processing.
Traceback shows it starts from WPMailSMTP\Core->get_tasks()
so I don't see how this is an AS problem.
If you have a server Cron job, that triggers WP's wp-cron.php
file, then you should just disable the "WP cron" (constant to disable it is mentioned in the article above). This will prevent the AS actions to be triggered on frontend and backend requests (they will only be triggered by your server cron job).
"WP cron" is not a good solution, but not all web hostings allow cron job creation... That's why WP created this "cron" which runs on all page visits. AS hooks into that WP cron and we are using AS in the plugin...
Not using wp-cron.php, I've been running WP CLI-based cron for a long time now.
OK it's becoming clear I will need to dig into code analysis here.
Expected Behavior
No irrelevant queries on frontend requests, ever.
Current Behavior
On front page queries (and probably elsewhere), I see in Query Monitor:
Traceback:
Possible Solution
Use
is_admin() && ! wp_is_ajax()
to work with usage tracking.Steps to Reproduce
Screenshots