mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-24 19:32:46 +01:00
🐛 delay worker thread start
This commit is contained in:
parent
90ece05efc
commit
7f51408e0e
@ -61,8 +61,12 @@ Current commit: ${
|
||||
|
||||
// Fork workers.
|
||||
for (let i = 0; i < cores; i++) {
|
||||
cluster.fork();
|
||||
console.log(`[Process] worker ${i} started.`);
|
||||
// Delay each worker start if using sqlite database to prevent locking it
|
||||
let delay = process.env.DATABASE?.includes("://") ? 0 : i * 1000;
|
||||
setTimeout(() => {
|
||||
cluster.fork();
|
||||
console.log(`[Process] worker ${i} started.`);
|
||||
}, delay);
|
||||
}
|
||||
|
||||
cluster.on("message", (sender: Worker, message: any) => {
|
||||
|
Loading…
Reference in New Issue
Block a user