Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#98 - Fix native worker compatibility #109

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

Fordi
Copy link
Contributor

@Fordi Fordi commented Oct 10, 2024

Fixes: #98

This PR modifies the node module initialization to give it minimal context-awareness, such that it can work within a node:worker_threads worker.

See: https://github.com/nodejs/node/blob/main/doc/api/addons.md#context-aware-addons

@@ -1,7 +1,7 @@
{
"targets": [
{
"target_name": "fs-ext",
"target_name": "fs_ext",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: NODE_MODULE_INIT uses NODE_GYP_MODULE_NAME as an identifier, so this must be a valid identifier.

@@ -19,7 +19,7 @@
"node": ">= 8.0.0"
},
"dependencies": {
"nan": "^2.14.0"
"nan": "^2.21.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build was failing with nan 2.14.

@Fordi
Copy link
Contributor Author

Fordi commented Oct 23, 2024

@baudehlo hey, not to be a noodge, but have you had a chance to look at this?

@baudehlo
Copy link
Owner

baudehlo commented Oct 23, 2024 via email

@Fordi
Copy link
Contributor Author

Fordi commented Nov 1, 2024

Been a week, the maintainer hasn't responded. Please merge.

@baudehlo baudehlo merged commit c529380 into baudehlo:master Nov 1, 2024
@baudehlo
Copy link
Owner

baudehlo commented Nov 1, 2024

I merged it, but I've been trying to add Actions tests (it was originally setup using Travis), and the tests don't pass: #110

@Fordi Fordi deleted the worker-compat branch November 4, 2024 14:03
@Fordi
Copy link
Contributor Author

Fordi commented Nov 4, 2024

Haha. Mandatory, "it works on my local".

I'll have a look and see if I can figure out what's going wrong.

@Fordi
Copy link
Contributor Author

Fordi commented Nov 4, 2024

Ah. Run git pull --rebase origin master on your patch branch. The fs-ext.cc in there still has NODE_MODULE at the bottom, not NODE_MODULE_INIT. I'll comment the same on your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

This seems to break for worker threads
2 participants