I have a webapp that is supposed to run a resource-intensive task (function) that will take time to complete. I'm triggering this task by calling a url;
http://app.domain.com/process_file/@fileid
However, as expected, the web client waits for the task (function) to complete. This is likely to cause time outs.
Please suggest ways i can trigger the task and let the user continue navigating the webapp.
I have tried the following so far;
1. JQuery/ajax
2. Redirecting to a _blank page
NB: I have no access to the crontab or Scheduler. I'm using PHP, JavaScript & fat-free framework
I believe you're looking for the abort function:
function (Base $f3) {
// process request and send response to client (could be a redirect status)
$f3->abort(); // disconnect the client
// perform consuming task here
}
This is basically the solution suggested by Pavel Třupek, wrapped in a method for convenience.