Uh oh!
There was an error while loading. Please reload this page.
Initial implementation - #1
Conversation
47a5f1e to
875d998Compareraymondfeng
commented
Jul 28, 2016
Do we want to name the module as The current implementation of getCurrentContext() is NOT reliable due to flaws in othiym23/node-continuation-local-storage#59 and other issues. If the customer is open to latest version of Node (6.x), maybe we can try an enhanced module at https://github.com/Jeff-Lewis/cls-hooked which leverages Node async-wrap (https://github.com/nodejs/node-eps/blob/async-wrap-ep/XXX-asyncwrap-api.md). |
There was a problem hiding this comment.
It would be nice if this require was only done when using CLS. As soon as this require is done, all the instrumentation/patching of async-listener is fired which is not ideal.
We've seen stack overflows due to promise instrumentation and other people have seen similar things othiym23/async-listener#57 which goes away when instrumentation is disabled.
There was a problem hiding this comment.
I guess this could be done either in loopback or here.
ritch
commented
Jul 28, 2016
yes |
There was a problem hiding this comment.
Why ClsContext? To differentiate between a HTTPContext ?
There was a problem hiding this comment.
I am going to rename this to LoopBackContext.
ritch
commented
Jul 28, 2016
I like this idea! This will allow us to iterate at a faster pace on this module. Eg. opt into |
875d998 to
7d56227CompareAs soon as CLS module is loaded, the instrumentation/patching of async-listener is fired. This may cause stack overflows due to promise instrumentation. By loading CLS module lazily (only when used for real), we avoid this kind of problems in applications that are not using current-context at all.
7d56227 to
1f214bfComparebajtos
commented
Jul 29, 2016
Changes made:
@raymondfeng@ritch@seriousben LGTY now? |
raymondfeng
commented
Jul 29, 2016
LGTM |
as suggested by @raymondfeng in strongloop/loopback-context PR strongloop#1 comment #235931961
ritch
commented
Aug 9, 2016
👍 |
as suggested by @raymondfeng in strongloop/loopback-context PR strongloop#1 comment #235931961
as suggested by @raymondfeng in strongloop/loopback-context PR strongloop#1 comment #235931961
as suggested by @raymondfeng in strongloop/loopback-context PR strongloop#1 comment #235931961
as suggested by @raymondfeng in strongloop/loopback-context PR strongloop#1 comment #235931961
as suggested by @raymondfeng in strongloop/loopback-context PR strongloop#1 comment #235931961
as suggested by @raymondfeng in strongloop/loopback-context PR strongloop#1 comment #235931961
Based on our discussions, I think we should remove
getCurrentContextfrom LoopBack 3.0. In order to simplify upgrade path and allow community to take over maintenance of CLS-based current context, I want to follow the same process we did with loopback-boot and that is to extract the functionality into a standalone module that can be versioned independently.In this patch, I moved most of the context-related code from LoopBack to a new repository.
What was not moved:
ChainedContextand the code setting upstrongRemoting.getCurrentContextandjuggler.getCurrentContext. AFAICT, these two methods were not used anywhere in strong-remoting/juggler.What's next:
@raymondfeng@ritch please review
cc @strongloop/loopback-dev FYI