Skip to content

Commit f113f1e

Browse files
committed
take review feedback into account, remove unnecessary file
1 parent d023cae commit f113f1e

File tree

4 files changed

+12
-63
lines changed

4 files changed

+12
-63
lines changed

src/WorkResult.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/cluster.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import { NormalizedMessage } from './NormalizedMessage';
77
import { Message } from './Message';
88
import { RunPayload, RunResult, RUN } from './RpcTypes';
99

10-
// helper function
11-
function noneUndefined<T>(results: (T | undefined)[]): results is T[] {
12-
return results.every(result => !!result);
13-
}
14-
1510
// fork workers...
1611
const division = parseInt(process.env.WORK_DIVISION || '', 10);
1712
const workers: childProcess.ChildProcess[] = [];
@@ -58,7 +53,13 @@ parentRpc.registerRpcHandler<RunPayload, RunResult>(RUN, async message => {
5853
)
5954
);
6055

61-
if (!noneUndefined(workerResults)) {
56+
function workerFinished(
57+
workerResult: (Message | undefined)[]
58+
): workerResult is Message[] {
59+
return workerResult.every(result => typeof result !== 'undefined');
60+
}
61+
62+
if (!workerFinished(workerResults)) {
6263
return undefined;
6364
}
6465

src/service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ async function run(cancellationToken: CancellationToken) {
9090
}
9191

9292
rpc.registerRpcHandler<RunPayload, RunResult>(RUN, message =>
93-
run(CancellationToken.createFromJSON(typescript, message!))
93+
typeof message !== 'undefined'
94+
? run(CancellationToken.createFromJSON(typescript, message!))
95+
: undefined
9496
);
9597

9698
process.on('SIGINT', () => {

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3695,8 +3695,8 @@ typedarray@^0.0.6:
36953695
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
36963696

36973697
typescript@^3.0.1:
3698-
version "3.3.3333"
3699-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6"
3698+
version "3.4.2"
3699+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.2.tgz#9ed4e6475d906f589200193be056f5913caed481"
37003700

37013701
uglify-js@^3.1.4:
37023702
version "3.4.9"

0 commit comments

Comments
 (0)