8000 Merge pull request #54 from VarunBatraIT/patch-1 · masteramuk/examples@4a03f2e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4a03f2e

Browse files
authored
Merge pull request totaljs#54 from VarunBatraIT/patch-1
Update index.js
2 parents 458f9cd + 5d517c9 commit 4a03f2e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

session-cluster-redis/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@ if (!cluster.isMaster) {
1818

1919
F.http('debug');
2020
return;
21-
}
22-
23-
var numCPUs = os.cpus().length;
21+
}else{
22+
//Varun Batra <codevarun@gmail.com> Removed bug for cluster.fork is not a function since cluster isn't a master once forked.
23+
var numCPUs = os.cpus().length;
2424

25-
for (var i = 0; i < numCPUs; i++) {
25+
for (var i = 0; i < numCPUs; i++) {
2626

27-
// Run framework
28-
var fork = cluster.fork();
27+
// Run framework
28+
var fork = cluster.fork();
2929

30-
fork.on('message', onMessage);
30+
fork.on('message', onMessage);
3131

32-
// Send ID
33-
fork.send({ type: 'id', id: i });
32+
// Send ID
33+
fork.send({ type: 'id', id: i });
34+
}
3435
}
35-
3636
console.log('The cluster is running.');
3737

3838
function onMessage(message) {
3939
console.log('Message ->', message);
4040
}
4141

4242
// Use a terminal for testing:
43-
// $ siege -b -r 10 http://127.0.0.1:8000/
43+
// $ siege -b -r 10 http://127.0.0.1:8000/

0 commit comments

Comments
 (0)
0