No internet connection
  1. Home
  2. Ideas / Feature Requests

v7: Make it easier to start the job queue

By Stefan @stevygee2020-03-13 16:10:47.030Z

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
  1. Leon Stafford @leonstafford2020-03-13 16:33:57.170Z

    Good point!

    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

    1. SStefan @stevygee2020-03-20 12:35:42.110Z

      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_queue manually 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

      1. Leon Stafford @leonstafford2020-03-20 13:45:45.753Z

        Perfect!

        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.

        1. Leon Stafford @leonstafford2020-03-20 13:46:04.918Z

          Also, big thanks for fiddling with this when there's no documentation available yet!!!