如何在一定延迟后从另一个php api文件运行php api文件,而不使用sleep()?

I have two restful api endpoints; DispatchJob_Public.php and selectDriverForJobResult.php and I have to call selectDriverForJobResult.php from DispatchJob_Public.php after two minutes. How can i do that without using sleep()? Because i cannot afford putting server on busy wait (due to sleep function).

I have written a function in javascript and ajax to call the second file (selectDriverForJobResult.php), and that works fine when i hit the end point directly from browser but js doesnt work when the file is called from android or postman.

So i need a solution for this, that does not include cron job, javascript and sleep() function.

Thank you very much.

directly from php, there is no way

you can write a bash file and execute it with system

startBatch.sh

 sleep 2m
 php /path/fo/file.php

in your first file

system('./startBatch.sh >> null');