hazelcast / hazelcast-nodejs-client

Hazelcast Node.js Client
https://hazelcast.com/clients/node-js/
Apache License 2.0
150 stars 59 forks source link

Add config option for async_hooks support #524

Closed puzpuzpuz closed 4 years ago

puzpuzpuz commented 4 years ago

As AsyncLocalStorage core API was recently introduced in node v13.10.0 (and there will be a v12 backport soon), async_hooks module friendliness in various libraries should be a popular demand among Node.js community. Unfortunately, user-land queueing that we do in Automated Pipelining mode leads to context loss, so we should fix that.

The proposed solution is to add hazelcast.client.asynchooks.enabled config option (false by default, as the will be a small performance penalty when this option is enabled). Once this config option is enabled, we should enable async_hooks support in the underlying bluebird library. As all client operations return a bluebird Promise, this option should fix the issue.

Note: bluebird dependency has to be updated to v3.6.0+ to get asyncHooks config option. This task assumes new tests and a documentation section.

Potentially related with #529

puzpuzpuz commented 4 years ago

Closing this one in favor of #529