There is a function A and function B
What I would like to do is , after running function A, it start the counting , after 10 minutes it run the function B (for one time only).
Notice that during the counting, the function A can be run again , so that can be schedule multiple counting to run function B.
After some studies I found something call cron job, but as I use CPanel (linux based) , it seems it is design for repeat job instead of one time job.
Also, if I use sleep()
with 10 minute the server will no doubt busy and it has problem if the user leave before 10 minute
How to achieve that? I have already written the program for function B. Just need to run the url after 10 minutes after running the function A.
http://my_domain.com/yoga/api/video/check_processed
Thanks a lot.
When function A is called then you should insert timestamp in another database table.
You can also add another column in that table which will have (timestamp+10 minutes).
Now create a function say runCron() that will find out both the columns time difference and then when it is 10 minutes then it will execute function B. Set a cron job which will call runCron every minute.