Skip to content

Commit 04ed455

Browse files
authored
Exit the worker thread correctly instead of hanging (#6754)
1 parent d0404db commit 04ed455

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

packages/services/schema/src/composition-scheduler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export class CompositionScheduler {
102102
});
103103
};
104104

105+
// catch uncaught exception from worker thread. Worker thread gets terminated.
105106
worker.on('error', error => {
106-
console.error(error);
107107
this.logger.error('Worker error %s', error);
108108
Sentry.captureException(error, {
109109
extra: {

packages/services/schema/src/composition-worker.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,7 @@ export function createCompositionWorker(args: {
2222

2323
process.on('unhandledRejection', function (err) {
2424
console.error('unhandledRejection', err);
25-
console.error(err);
26-
args.port.postMessage({
27-
code: 'ERROR',
28-
err,
29-
});
30-
process.exit(1);
31-
});
32-
33-
process.on('uncaughtException', function (err) {
34-
console.error('uncaughtException', err);
35-
args.port.postMessage({
36-
code: 'ERROR',
37-
err,
38-
});
39-
process.exit(1);
25+
throw err;
4026
});
4127

4228
args.port.on('message', async (message: CompositionEvent) => {

0 commit comments

Comments
 (0)