Answer the question
In order to leave comments, you need to log in
What is the best way to implement a "long-playing" parser as a plugin for Wordpress?
I am writing a WP plugin for automatically adding / updating products in Woocommerce from a donor site. The parsing process should be run every few days via wp cron and will last about 1-2 hours. Because the execution time of php scripts on the server is limited to a few minutes and due to the fact that the parser can crash due to errors, it is necessary to implement the ability to perform work in parts. To do this, while the parser is running, the current processed product is written to the transient option. At the next start, work continues from the position saved in the state. If all items are processed, the option is removed. Now the question arose of how best to implement the re-launch of the parser after performing partial processing. Two options come to mind:
max_execution_time
and assign a single task after max_execution_time
+ a few seconds. If the goods are over, then delete this task.Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question