This is a common question from users but before we dive in, there are two important concepts to consider and understand.
The first is that queues are good system design for funnels. This means that events are scheduled in order and when they are executed, and if they fail, they can try again. Given how uncertain the digital world can be especially when servers are under load e.g. Big launch days, Black Friday etc it is important that the system has a record of what it has to do and what to do if things go wrong.
In other words, the Groundhogg Events queue is necessary for smooth funnels.
Next, you need to understand how events work in WordPress. WordPress, like many other web technologies, is based on PHP. Unlike the device you are reading this on, PHP is effectively stateless. This means it only works when you call it e.g. Load a website page, interact with your website. As soon as it’s work is done, it closes down and goes back to sleep. The code itself has no memory of being called.
This means that PHP has no concept of events e.g. I need to wake up and send that email in 40 seconds. You need to periodically wake it up and ask it to check. For WordPress, this system is called WP Cron and it works by the following URL being called on your site:
When wp-cron.php is called, the WordPress system checks for any events to be run, execute them and then goes back to sleep. The trick to good design is that you want to call wp-cron.php as often as possible without overcalling it. Generally speaking, most sites call wp-cron.php every 5 to 10 minutes but there is nothing stopping you from calling it every minute. Note however that every call places load on your server, so you should only call it as often as needed.
Note: WP Cron is called automatically when a person scrolls through your site. Therefore if you have a busy site with plenty of traffic, you do not need to call wp-cron separately. If you have low traffic, or what your site to have a consistent cron, you could use a service like https://www.setcronjob.com/. Alternatively, many hosts provide services via CPanel to trigger your WordPress cron from the server.
A number of sites indicated that WP Cron impacts performance and whilst this is partly true, you would only disable it if you are calling WP Cron separately and directly.
So, how does WP Cron impact Groundhogg?
When a funnel is triggered in Groundhogg, Groundhogg places the events for that funnel into a specific Groundhogg Events queue. You can see this queue in your Groundhogg settings:
This queue is scheduled to operate every 60 seconds. If there is an event that is ready to go i.e. The time it is to be executed is here or has passed, the event will fire.
Remember, the Groundhogg event will only fire if your site has consistent traffic or wp-cron is being called in a consistent manner. If your site has low traffic, and no wp-cron being called, your events will only fire when wp-cron is called which could be minutes, hours or even days after the event was supposed to fire.
How can I ensure my Groundhogg Events fire on time?
Ensure your WordPress site has a consistent wp-cron either by using a service like https://www.setcronjob.com/ or via your CPanel of your host. If you require rapid queues, I recommend a period of between 1 and 5 minutes between calls.
Are Groundhogg events fired one by one?
No, when the queue for Groundhogg is called, a number of events are fired in batches. This means that you don’t need to wait for each cycle for each event to be fired. In each cycle, there could be more than 20+ events fired and they generally continue to fire for as long as possible (In technical language, they fire until the PHP execution time is nearly exhausted)
Can I manually trigger or retry events?
Yes! Simply hit Process Events in the Groundhogg Event page. You can also see failed and cancelled events on the same page.
How do I process events really fast?
To process events really fast, you should consider the do_action( ‘groundhogg_process_queue’ ) of Groundhogg and call it externally via your own cron or similar. Groundhogg give a full ‘how to’ for this process here.
Need more info? Feel free to contact me or see https://help.groundhogg.io/