This is a question about WordPress architecture, that I wasn't able to fully understand by reading WordPress documentation.
I have a scheduled event that can take more than 1 minute to finish because it's a heavy stored procedure that create a few caches on my database.
As far as I know, scheduled events in WordPress (wp_schedule_event
) are triggered only when a request is made on the website. So, I imagine that if I schedule this event to run every day at 3:00 AM (which is the less crowded hour of my website) it'll trigger after 3:00 AM on the first request and it can happen a few minutes after this time if nobody is visiting it. Am I right?
Still, if I'm right, let's say a user opens my website at 3:01 AM and it triggers my scheduled event... will this user have to wait 1 minute until it ends so the website is loaded? Or this scheduled event happens in a thread?