We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 382842b commit 859e047Copy full SHA for 859e047
worker/index.js
@@ -5,6 +5,8 @@ import { execShellCommand } from "./utils/execCommand.js";
5
import { codeRunner } from "./utils/codeRunner.js";
6
import { Worker } from 'bullmq'
7
import Logger from "@code_blaster/logger";
8
+import cluster from 'cluster'
9
+import os from 'os'
10
11
const worker = new Worker('code_submission', async (job) => {
12
if (job.name == "code_langauge") {
@@ -49,4 +51,11 @@ const main = async () => {
49
51
worker.run()
50
52
}
53
-main();
54
+if (cluster.isMaster) {
55
+ const numCPUs = os.cpus().length;
56
+ for (let i = 0; i < numCPUs; i++) {
57
+ cluster.fork();
58
+ }
59
+}else{
60
+ main();
61
+}
0 commit comments