Answer the question
In order to leave comments, you need to log in
Implement a node.js request processing queue?
When accessing the port, a rather resource-intensive thing is launched - electron.js. If at the same time ten people turn to this port, then the server will fall (there is no money for a more powerful one). I need that if ten people applied to the port, then a queue would be created for processing these requests and they would be processed one by one. That is, in general, if one request is already being processed at the moment, then all the others are pending. Tell me how to implement it?
var http = require("http");
http.createServer(function(request, response){
//тут запуск электрона
});
response.end();
}).listen(8080);
Answer the question
In order to leave comments, you need to log in
The simplest, through setTimeout - the interpreter itself will resolve these requests in turn of timers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question