Skip to content

Commit 36f3a55

Browse files
authored
Fix Node Workers (#150)
1 parent e418c16 commit 36f3a55

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

ingestors/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metlo",
3-
"version": "0.0.12",
3+
"version": "0.0.13",
44
"license": "MIT",
55
"description": "The node agent for Metlo API Security.",
66
"main": "dist/index.js",

ingestors/node/src/pool/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ class WorkerPoolTaskInfo extends AsyncResource {
1313
}
1414

1515
done(err, result) {
16-
this.runInAsyncScope(this.callback, null, err, result);
16+
if (this.callback) {
17+
this.runInAsyncScope(this.callback, null, err, result);
18+
}
1719
this.emitDestroy(); // `TaskInfo`s are used only once.
1820
}
1921
}

ingestors/node/src/pool/workerTarget.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ parentPort.on('message', ({ data: postData, host, key }) => {
1414
data: postData
1515
}).catch((error) => {
1616
console.warn("Encountered an error with metlo ingestor.\nError: ", error.message);
17+
}).finally(() => {
18+
parentPort.postMessage("done")
1719
});
1820
});

0 commit comments

Comments
 (0)