v7: Make it easier to start the job queue
Using v7 alpha 002, I'm having trouble getting the job queue to start. I have set the cron interval to 1 minute, but no matter how often I refresh, all jobs will just remain in the "waiting" stage. Going to wp-cron.php sometimes works, but not reliably. Using wp-cli works, but I would like my client to be able to trigger the export using the UI.
It's not obvious that clicking on "Manually Enqueue Jobs Now" does not actually start the queue. Can you please add a button that starts the job queue?
- 4 replies
- Leon Stafford @leonstafford2020-03-13 16:33:57.170Z
It is usually recommended with WP to use regular cron vs wp-cron, as wp-cron only triggered when site pages are loaded/refreshed.
For WP2Static, there's a WP-CLI command (haven't updated docs, but I think
wp wp2static process_queue.
I'll look into options for triggering queue process from UI without blocking/being dependent on page staying open.
Thanks for giving early V7 build a try and please ping me with any new issues/questions
Hi, thanks for helping me understand WP-Cron. I have now set up a cron job using crontab to call WP-Cron every 5 minutes.
I've also installed the WP Crontrol plugin to see if the wp2static job was there and it turned out that it hadn't been added for some reason. So I added the hook
wp2static_process_queuemanually and now it works. On the WP Crontrol page, there is also a handy "Run now" link, which I was looking for.
Re wp-cli: I don't think this command exists anymore, instead I have been using:
wp wp2static detect
wp wp2static crawl
wp wp2static post_process
wp wp2static deploy
- Leon Stafford @leonstafford2020-03-20 13:45:45.753Z
To use with WP-Cron/Crontrol now, we can call the process_queue event (will check name/existence, but will get it available). The aim is that the "jobs" are created automatically on those post update/site change events, then the cron task is just calling "process queue", which will run through in correct order, any detect/crawl/process/deploy jobs that have been queued (as per the options to which jobs get auto-queued in jobs screen). Alternatively, can manually add a job anytime and will be picked up in next queue processing. It does some other things, like squashes down any duplicate queued jobs that are in waiting status, ie if you add 5 posts in 1 minute, but your schedule is set for every 5 mins, you'll just get 1 deploy with all changes, not 5 x deploys.