Open shuckc opened 5 years ago
Seems relevant: Another module with same issue: https://github.com/schroffl/node-lzo/issues/10 Reported fix: https://github.com/nodejs/node/issues/21783#issuecomment-429637117
Node docs for context-aware-addons: https://github.com/nodejs/node/blob/master/doc/api/addons.md#context-aware-addons
Thanks, I'll try to fix it
Sadly but, not enough to just use NODE_MODULE_INIT
(BTW this was hard to do)
Seems like I must migrate from NaN
to N-API
via node-addon-api
to correctly support workers, this will take little bit time and may not be stable.
Will update here.
Any Updates on this?
No, need to completely rewrite C++ part of the module. So actually it will be a new driver. Sadly but I don't have enough free time now to rewrite and test it.
If
redis-fast-driver
isrequire
ed by both the 'main thread' and also a worker thread, the 2nd attempt fails and triggers an Error in the cjs loader.Reproducing code -
worker.js
:Output:
It seems to me there might be some additional work on the C++ side to have a module support being required twice. This is an issue even if the worker does not invoke the client on the codepath, just requires it.