How to perform an action after some minutes

Good day, please I have something to achieve.
I am working on a dispatch app and when a request is made, I want to get the closest 5 riders and assign the request to them.

I will take the first rider and send a notification to him, If he accepts, then that’s all but if he declines, I send to the next rider; but if he doesn’t accept or decline after 3 minutes, I will move to the next rider.

I am able to get everything to work except for the part of “if he doesn’t accept or reject after 3 minutes, I will move to the next rider”.

Any solution to this?

Well, you just check the current date-time and check it over and over.
Really depends on your code and how you are making the system run.
PHP is set up to react to inputs, not run timed functions.
You can run a CRON job that runs every minute and checks records and executes tasks based on the records. Or you can place a Javascript code on the page to recheck after a set time.
It really depends on how all of this is set up. You did not mention how you are doing all the other tasks.
No mention of your code at all. Give us a little more info on how you do the rest and we can help!

Sponsor our Newsletter | Privacy Policy | Terms of Service