@@ -12,15 +12,11 @@ const workers: childProcess.ChildProcess[] = [];
12
12
13
13
for ( let num = 0 ; num < division ; num ++ ) {
14
14
workers . push (
15
- childProcess . fork (
16
- path . resolve ( __dirname , './service.js' ) ,
17
- [ ] ,
18
- {
19
- execArgv : [ '--max-old-space-size=' + process . env . MEMORY_LIMIT ] ,
20
- env : Object . assign ( { } , process . env , { WORK_NUMBER : num } ) ,
21
- stdio : [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ]
22
- }
23
- )
15
+ childProcess . fork ( path . resolve ( __dirname , './service.js' ) , [ ] , {
16
+ execArgv : [ '--max-old-space-size=' + process . env . MEMORY_LIMIT ] ,
17
+ env : Object . assign ( { } , process . env , { WORK_NUMBER : num } ) ,
18
+ stdio : [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ]
19
+ } )
24
20
) ;
25
21
}
26
22
@@ -46,13 +42,10 @@ process.on('message', (message: Message) => {
46
42
workers . forEach ( worker => {
47
43
worker . on ( 'message' , ( message : Message ) => {
48
44
// set result from worker
49
- result . set (
50
- worker . pid ,
51
- {
52
- diagnostics : message . diagnostics . map ( NormalizedMessage . createFromJSON ) ,
53
- lints : message . lints . map ( NormalizedMessage . createFromJSON )
54
- }
55
- ) ;
45
+ result . set ( worker . pid , {
46
+ diagnostics : message . diagnostics . map ( NormalizedMessage . createFromJSON ) ,
47
+ lints : message . lints . map ( NormalizedMessage . createFromJSON )
48
+ } ) ;
56
49
57
50
// if we have result from all workers, send merged
58
51
if ( result . hasAll ( ) ) {
0 commit comments