Scheduling a task using class methods

I actually found out that the Cron works, just not as I expected. I refreshed the pages and called wp-cron.php (using wget) a couple of times, and I kept seeing my cron task schedule with “-X seconds“. Then I stopped for a minute or two, and refreshed the frontend page of the site, and my Cron task got called.

When it was time for the second scheduled execution, one hour later, I repeated the test. Task was due in a couple of seconds, so I waited about 10 seconds an loaded a random page: nothing happened. I waited another half a minute or so, loaded again a random page, and the task got called.

It seems that WordPress has a “relaxed” way of calling Cron jobs, which I don’t fully understand yet. Anyway, my approach was correct, my expectations were not. 🙂