-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use cls-hooked with loopback-context? #9
Comments
EDIT: if you are here, I guess that you already read strongloop/loopback#1495 for an alternative approach than loopback-context. |
@josieusa since Also, your note about |
@josieusa thx for the info, i just can't do shrinkwrap, as it gives maximum call stack size exceeded error, apparently it happens if there is circular dependencies. It's fixed in 3.10.7 it looks (npm/npm#13327) but sill not available to download. I tried to install it using npm@next but no luck. I'll do when it becomes available. Anyways, I'm using getCurrentContext in few places in my project, and so far I have no problem yet, running on two beanstalk instances on aws for staging and production. We're using mysql in storage layer. Our project is used internally in our company still, but we plan to rollout to public in November. So, I tend to keep my code as it is until AsyncWrap becomes official, or until having problem with getCurrentContext, though I must tell using a not reliable lib scares me a lot. Although I didn't like much the proposal in strongloop/loopback#1495, but it looks I might need to try it out. Any thoughts? |
|
@Jeff-Lewis I'd encourage you to open a PR to CLS at least. We can leave it open until async_wrap lands officially but work toward readiness, so CLS is ready to go immediately when async_wrap lands. We'd still need a polyfill though, so either async_wrap would need a polyfill or we'd need to fallback to the async-listener module it uses currently, when async_wrap is unavailable. |
@Qard That sounds good. I'd be happy to. |
@ahmetcetin does the last commit to PR #11 help solve your issue? Let me know! |
We are working on a new semver-major version of loopback-context that will use cls-hooked under the hood. The change has been already implemented by #11. I am closing this issue as done. |
I'm using Node 6, and I rely on loopback-context module, actually just switched to it as per recommendation in the recent warnings, previously I was using loopback.getCurrentContext(). I read the issues on continuation-local-storage, and this package looks still relying on it, but it's mentioned in readme that it's suggested to use cls-hooked instead for Node 6 users. Can you suggest how can I use cls-hooked with loopback-context? Is it enough to fork and just replace continuation-local-storage with cls-hooked in require calls?
The text was updated successfully, but these errors were encountered: