5 ms·
I've always been under the impression that concepts like thread/continuation-local storage were generally discouraged, but I never fully understood the reason.
by rwbcxrz 8y ago
I've always been under the impression that concepts like thread/continuation-local storage were generally discouraged, but I never fully understood the reason.
Obviously, you'd want to avoid coupling your code to an HTTP-specific context if you want to expose a gRPC endpoint in the future.
Are there any other downsides to this approach?
- gcommer 8y agoThe problem is that all CLS systems in JS are inherently leaky, due to the many games JS libraries/apps can (and do) play with resource pooling. Implementors basically have to play a plug-the-holes game getting all the popular libraries to properly "play along" with the CLS system. For example, domains needed tons of PRs very similar in nature to this: https://github.com/sequelize/sequelize/pull/589/files#diff-1fcbe253f68a98bb45ab62b33825d759R8 https://github.com/sequelize/sequelize/pull/589/files#diff-1... Also, they typically come with a sizable perf hit: https://github.com/bmeurer/async-hooks-performance-impact https://github.com/bmeurer/async-hooks-performance-impact