caden311 caden311 - 1 month ago 8
Node.js Question

Why is my Node express .post being called multiple times, and my res.send() never resolves the $http request?

My request look this -

$http.post('/api/internal/Properties/' + options.property.id + '/Upload', { Buildings: Buildings })
.success(function (data){


on the server side, this request can take a long time to process. Up to 5 minutes. Before it can finish (res.send()), the $http.post request is being called again, every few minutes.

When it finally does finish processing, the res.send(data) is never caught on the client side. It's like it just disappears.

Anything would help.
Thanks,

Answer

Each browser has it's own http request timeout. So it will not wait for 5 minutes to complete request it would just fail. Browser Timeouts .

In chrome it's 30 or 60 seconds.

In your case i suggest use sockets or something like that to show user what's up with uploading.

Hope this helps.