Skip to content

Commit

Permalink
fix: communication with worker thread not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Dec 6, 2023
1 parent 861b704 commit 6a72f6b
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions src/main/ipc-handlers/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,8 @@ export default (connections: {[key: string]: antares.Client}) => {
});

// Exporter message listener
exporter.stdout.on('data', (buff: Buffer) => {
let message;
try { // Ignore non-JSON data (console.log output)
message = JSON.parse(buff.toString());
}
catch (_) {
if (process.env.NODE_ENV === 'development') console.log('EXPORTER:', buff.toString());
return;
}

const { type, payload } = message as workers.WorkerIpcMessage;
exporter.on('message', (message: workers.WorkerIpcMessage) => {
const { type, payload } = message;

switch (type) {
case 'export-progress':
Expand Down Expand Up @@ -331,17 +322,8 @@ export default (connections: {[key: string]: antares.Client}) => {
});

// Importer message listener
importer.stdout.on('data', (buff: Buffer) => {
let message;
try { // Ignore non-JSON data (console.log output)
message = JSON.parse(buff.toString());
}
catch (_) {
if (process.env.NODE_ENV === 'development') console.log('IMPORTER:', buff.toString());
return;
}

const { type, payload } = message as workers.WorkerIpcMessage;
importer.on('message', (message: workers.WorkerIpcMessage) => {
const { type, payload } = message;

switch (type) {
case 'import-progress':
Expand Down

0 comments on commit 6a72f6b

Please sign in to comment.