I 'm improving a cron job which loops a lot of stuff and updates my database. I would like to make ut wait, let's say 30 seconds every 100 requests.
Something like:
loop{
loop{
query();
}
wait(3000); // wait 3 seconds and continue
}
Can I do that? If so, is it possible the the cron job times out?
Thanks!
You can set execution time limit to infinity with this:
set_time_limit(0);
And then you can use sleep()
function to pause the execution.