App Engine frontend waiting for backend to finish and return data - what's the right way to do it?
<p>I'm using a frontend built in angularjs and a backend built in python and webapp2 in app engine.</p>

<p>The backend makes calls to a third party API, fetches data and returns to the frontend.</p>

<p>The API request from the backend may take upto 30s or more. The problem is the frontend can't really progress any further until it gets the data.</p>

<p>I tried running 3 simultaneous requests to the backend using different tabs and 2 of them failed. I'm afraid that this seems to suggest that the app only allows one user at a time.</p>

<p>What's the best way to handle this? One thought I have is:</p>

<ul>
<li>Use <a href="https://cloud.google.com/appengine/docs/java/taskqueue/?csw=1" rel="nofollow">task queues</a> to run the API call to 3rd party in the background</li>
<li>Create a new handler which reads from the queue for the last task sent and let the frontend poll this one at regular intervals</li>
<li>Update the frontend once data is available</li>
</ul>

<p>Is that the right way? I'm sure this is a problem solved in a frontend+backend kind of world, but I just don't know what to search for.</p>

<p>Thanks!</p>

<p>Requests from the frontend are capped at 30 seconds; after that they time out in the server side. That is part of GAE's design. Requests originating from the task queue get 10 minutes, so your idea is viable. However, you'll want some identifier to use for polling, rather than just using "the last sent," to distinguish between concurrent tasks.</p>

python angularjs google-app-engine