S
S
suhuxa12018-03-04 13:27:08
WordPress
suhuxa1, 2018-03-04 13:27:08

How to block re-enable feature by wordpress scheduler?

Hey!
Added to the scheduler the execution of the function every hour. Now the question is - is there a 100% guarantee that this function will be executed only 1 time and that's it, there will be no accidental double launch of the function? I think that there is no 100% guarantee in anything, so I would like to somehow protect myself from this. So how to put some kind of blocker that would work for the duration of the function? And only then only allowed her to start again?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Orkhan Hasanli, 2018-03-04
@azerphoenix

Hello.
Scheduling (WP-Cron) pseudo crons, like Cron, will execute the task at the time you specify, if everything is done correctly. However, unlike CRON, WP CRON may not work if there is not enough traffic (users) on the site.

K
Kalombyr, 2018-03-04
@Kalombyr

Pref. Can be executed arbitrarily times. Kron doesn't have a double run disable feature.
The simplest thing is to create some file or record in the database that the function started execution and remove it when it ends (only test for emergency situations so that the record is removed when they occur). But in general, it would be best of course to do this outside - with an external application, for example, using lockrun , but if it's vps, if it's regular hosting, then alas.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question