SQLITE3 Nodejs multithreading
const cluster = require('cluster');
const db = new sqlite3.Database(':memory:')
if (cluster.isMaster) {
console.log(`Master ${process.pid} is running`);
cluster.fork()
.on('exit', (worker, code, signal) => {
console.log(`worker ${worker.process.pid} died`);
});
cluster.fork()
.on('exit', (worker, code, signal) => {
console.log(`worker ${worker.process.pid} died`);
});
} else if (cluster.worker.id === 1){
db.run(QUERY1);
} else {
db.run(QUERY2);
}
JulesG10