I need the ability to run tasks in the background, or at a later date from when the code was initiated on my website.
For example, I have a database of projects. The projects are created and managed by “Project Managers” and the actual task at hand can be completed by “Users”. As soon as a Project Manager marks a project as completed, I transact payment and the User gets paid. However, in certain instances a User may complete a project, but a Project Manager neglects to mark the project as complete. So, I need to set it up where a User can mark a project as completed and if the Project Manager does not contest that after 3 days, it automatically marks itself as completed.
So, I need the code to operate where as soon as a User marks a project as complete, it will wait 3 days, check to see if Project Manager marked it as complete and if not, complete it and transact charge regardless.
Ideally, this can be achieved using a setTimeOut that initiates when a User marks the project as completed and 3 days later it will check to see if it has been marked as complete by the Project Manager. If yes, then no action. If it has not, then it transacts the funds.