Uh oh!
There was an error while loading. Please reload this page.
[WIP] Use cls-hooked instead of continuation-local-storage - #2
Conversation
as suggested by @raymondfeng in strongloop/loopback-context PR strongloop#1 comment #235931961
raymondfeng
commented
Jul 29, 2016
@josieusa Thank you for the patch. One possibility is to make it conditional based on the minimum Node.js version. |
josieusa
commented
Jul 29, 2016
@raymondfeng I was just going to commit the conditional logic you are talking about. I only need to do more testing. |
slnode
commented
Jul 29, 2016
Can one of the admins verify this patch? |
bajtos
commented
Aug 1, 2016
@josieusa thank you for the patch, it's great to see community contribution so quickly after creating this new module! 👏 I am afraid the conditional require will not work well, because I guess we could go with an optional dependency? Alternatively, we can have @raymondfeng thoughts? |
@bajtos Regarding the lost context issues with I made an example Loopback v3 app which tries to reproduce the bug (i.e. it uses
So, manual tests suggest that this branch of mine doesn't solve the lost context issue, at least for So, before continuing to contribuite, I'm going to try to figure out why the two apps behave differently in my manual tests, i.e. what are the differences between the two apps (if any, because it could be just |
raymondfeng
commented
Aug 1, 2016
@bajtos@josieusa As you have brainstormed, there are a few options to make cls-hooked conditional.
|
Good news. I figured out the differences between my two test apps, and all my manual tests are passing now. |
slnode
commented
Aug 2, 2016
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
bajtos
commented
Aug 2, 2016
Please don't open a new pull request and keep your changes in this pull request (your feature branch). That way the history of our discussion is preserved in a single place. |
As suggested by @raymondfeng in strongloop/loopback-context PR strongloop#2 comment #236644728
davidcheung
commented
Aug 4, 2016
Leaving a note here, @marlonkjoseph had a snippet that reproduces continuation-local-storage loosing active context |
Thanks, I will use it to write a test that fails with the official branch but not this branch of mine. |
Hello, |
I couldn't manage to detect when
I believe it's an improvement, I only need to test it. |
As suggested by @raymondfeng in strongloop/loopback-context PR strongloop#2 comment #236644728
josieusa
commented
Aug 23, 2016
I continued experimenting, and I just had some success in detecting if some of the "cls-unfriendly" modules are imported, and also if the necessary CLS shims for those modules (for example |
Great news! Just pushed! The approach I described is implemented for the most part, and is clear from looking at the tests now. I summarize again:
Let me know if someone wishes to give a look at it. For example, launch the tests by running |
bajtos
commented
Sep 6, 2016
@josieusa Hey, I am glad you are making progress in your work here. We (the LoopBack team) don't have applications where to test your new version, and to be honest, CLS-based current-context is not a priority for us. Take as much time as you need to get this pull request into state where you consider it production-ready. We'll leave this work in the hands of you and any other community members interested in CLS-based current-context. Just let us know when you get to the state where you will consider the implementation production-ready. |
josieusa
commented
Dec 21, 2016
I closed this in favor of PR #11 |
Hello,
I just wanted to let you know that, in this branch of mine,
npm run testpasses.So, this PR is meant as a starting point for you.
Of course there are still two unsolved problems at least:
PS
npm run testpasses using loopback v2, too.Thank you for your attention.
Contents of this PR:
Use cls-hooked instead of continuation-local-storage,
as suggested by @raymondfeng
in strongloop/loopback-context PR #1 comment #235931961
#1 (comment)