M
M
Max_Borisov2018-12-20 20:20:09
Task Schedulers
Max_Borisov, 2018-12-20 20:20:09

Working with WP-Cron?

Good afternoon! There are a few questions about how WP-Cron works.
1) Suppose there are n tasks on the site that must run at a certain time. No one visited the site for a long time, after someone entered the site, they began to work out the necessary scripts. In what order will these scripts be run? One at a time or all at once?
2) There is a long script that needs to be run when updating/adding/editing a record. If you run it with WP-Cron, it crashes. What is the best way to process such a long script? There is no way to send axaj requests and check how many have been completed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2018-12-20
@HeadOnFire

The built-in WP Cron is suitable only for the simplest tasks, for more reliable operation, clearly use OS-level cron when necessary. Turn off the built-in cron in the config: And create a cron task at the OS level, setting the desired interval and command like:
Instead of wget, you can use curl, httpie, or /usr/local/bin/php, see here for the situation. You can google how to set up cron tasks from the command line, how to add if you have any CPanel - too.
And there is also https://github.com/humanmade/Cavalcade
Well, for long and asynchronous scripts there is RabbitMQ and that's it. Check out https://github.com/10up/WP-Minions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question