I have an application which sends an AJAX request to execute some server-side code. This code takes approximately 10 minutes to execute and respond with data.
Both the web server and browser timeout well before this operation completes. What is the best way to structure this request to prevent a gateway timeout?
The ajax request responds with a json object. Is this the correct structure for handling this?
Client executes ajax to start server-side processing
|
|___server working to process data (ETA 10 min)
| |
| server finishes and writes file with json object
|
Client recursively ajax requests some endpoint to check for completion
|
|___endpoint returns true
|
ajax request for server generated JSON file