Answer the question
In order to leave comments, you need to log in
How to do clustering correctly?
Hello. Wrote a telegram bot on node.js. I ran into a problem at the stage of creating clustering manually. The code is the following:
const cluster = require("cluster");
const os = require("os");
const count = os.cpus().length;
cluster.setupMaster({exec: 'main.js'});
for (let i = 0; i < count; i++) {
cluster.fork();
}
cluster.on('exit', (worker) => {
console.log(`worker ${worker.process.pid} died`);
});
console.log('Кластерзация работает');
NODE_DEBUG=cluster node main.js
, clustering does not work, as I understand it, because the console is empty. When launched NODE_DEBUG=cluster node boost.js
, the desired message is displayed in the console, but at the same time, 4 identical ones from the bot come in response to each user message, but only one should. That is, for one incoming request, the same handler is triggered, but 4 times. Answer the question
In order to leave comments, you need to log in
editor='".$my['id']."'
Maybe this option
select id from art where user_id in (select id from users where moderator_id = 2)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question