File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -18,26 +18,26 @@ if (!cluster.isMaster) {
18
18
19
19
F . http ( 'debug' ) ;
20
20
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 ;
24
24
25
- for ( var i = 0 ; i < numCPUs ; i ++ ) {
25
+ for ( var i = 0 ; i < numCPUs ; i ++ ) {
26
26
27
- // Run framework
28
- var fork = cluster . fork ( ) ;
27
+ // Run framework
28
+ var fork = cluster . fork ( ) ;
29
29
30
- fork . on ( 'message' , onMessage ) ;
30
+ fork . on ( 'message' , onMessage ) ;
31
31
32
- // Send ID
33
- fork . send ( { type : 'id' , id : i } ) ;
32
+ // Send ID
33
+ fork . send ( { type : 'id' , id : i } ) ;
34
+ }
34
35
}
35
-
36
36
console . log ( 'The cluster is running.' ) ;
37
37
38
38
function onMessage ( message ) {
39
39
console . log ( 'Message ->' , message ) ;
40
40
}
41
41
42
42
// 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/
You can’t perform that action at this time.
0 commit comments