I have a web app that has a few processes that can take up to 10 minutes to run. Sometimes these processes are triggered by a user and they need the output as it is processed.
For instance, the user is looking for a few records that they need. The click the button to retrieve the records (this is the part that can take 10 minutes). They can continue to work on other things but when they click back to view the returns, it is updated as the records are downloaded into the system.
Right now, the user is locked while the process runs. I know about pcntl_fork() to fork a child process so that the user doesn't have to wait until the long process completes.
I was wondering if it's possible to tie that forked process to the specific user that triggered the request in a $_SESSION
variable so that I can update the user when the process is complete. Also, is this the best way to update a user on a long-running process?