Skip to content

Add loopback.runInContext #1254

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

Merged
merged 1 commit into from
Mar 27, 2015
Merged

Add loopback.runInContext #1254

merged 1 commit into from
Mar 27, 2015

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Mar 27, 2015

Refactor the core implementation of current context from server/middleware/context.js into server/current-context.js.

Expose new public API:

  • loopback.runInContext
  • loopback.createContext

Connect to #982

Browser support is out of scope of this pull request, see othiym23/node-continuation-local-storage#36

/to @raymondfeng @ritch please review

@bajtos bajtos added the #review label Mar 27, 2015
@bajtos bajtos assigned bajtos and raymondfeng and unassigned bajtos Mar 27, 2015
@bajtos bajtos added this to the #Epic: Offline Sync V1 milestone Mar 27, 2015
@raymondfeng raymondfeng assigned bajtos and unassigned raymondfeng Mar 27, 2015
@raymondfeng
Copy link
Member

LGTM

Refactor the core implementation of current context from
server/middleware/context.js into server/current-context.js.

Expose new public API:
 - loopback.runInContext
 - loopback.createContext
@bajtos bajtos force-pushed the feature/run-in-context branch from 0e280fc to 2aa09ba Compare March 27, 2015 18:12
bajtos added a commit that referenced this pull request Mar 27, 2015
@bajtos bajtos merged commit 6640f8a into master Mar 27, 2015
@bajtos bajtos deleted the feature/run-in-context branch March 27, 2015 18:15
@bajtos bajtos removed the #review label Mar 27, 2015
@seriousben
Copy link
Contributor

May be out of scope completely, but do you know of way to run out of scope?

Use case: running some piece of code that is async (Job on another node)
normally except in test mode. But running that code in test mode result in
it being run within the current Loopback context while it would normally
run without context normally.

Thanks a lot
On Mar 27, 2015 2:15 PM, "Miroslav Bajtoš" [email protected] wrote:

Merged #1254 #1254.


Reply to this email directly or view it on GitHub
#1254 (comment).

@bajtos
Copy link
Member Author

bajtos commented Mar 30, 2015

@seriousben I am afraid I don't understand you. You want to step outside of the current context, so that getCurrentContext returns null in that code? Like loopback.runWithoutContext?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants