1

I wanna make a bunch of (let's say 20) HTTP POST requests (in order to send information of an app to some HTTP servers) simultaneously.

I am using http angular service to return a promise:

function deployPromise(server, app){
  return $http({
    method: 'POST',
    url: server.url,
    data: app
  });
}

For simultaneous deployments I am using Promise.all that gets the array of deployPromises:

function deploy(servers, app){
  Promise.all(servers.map(function(server){
    return deployPromise(server, app);
  }));
}

Finally I call deploy function with array of available servers and the app info:

deploy(servers, app);

To my surprise, instead of executing all at once, requests are sent (in otherwords, deployPromises are resolved) in a group of 6. I mean, when the first 6 calls are done, then the second 6 calls will be processed and so on.

Do you guys have any idea?

farshad
  • 189
  • 1
  • 1
  • 6

1 Answers1

4

This is a browser limitation, you can't open a infinite number of simultaneous connections. Max parallel http connections in a browser?

Community
  • 1
  • 1
Hitmands
  • 13,491
  • 4
  • 34
  • 69