function fn(id){
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log(id);
resolve(id);
}, Math.random() * 1000);
});
}
for(let i = 0; i < 100; i++){
fn(i);
}
upstream myapp_2_socket {
ip_hash;
server 127.0.0.1:2255;
}
location /web/myapp2/ {
proxy_pass http://myapp_2_socket/;
...
}
location ~ ^/(socket\.io) {
proxy_pass http://myapp_2_socket;
...
}
server {
listen 80 default;
server_name noname;
access_log /dev/null;
error_log /dev/null;
return 444;
}
server {
listen 80 default_server;
server_name MY_IP_ADDRESS;
root /usr/local/www/;
index index.html index.htm;
}