Created
October 2, 2015 07:52
-
-
Save ryanstevens/8eb04268fbea267122a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var cls = require('continuation-local-storage'); | |
var ns = cls.createNamespace('test'); | |
ns.run(function() { | |
ns.set('foo', 'bar'); | |
setTimeout(function() { | |
console.log("This is fine " + ns.get('foo')); | |
}, 0); | |
request('http://localhost:2382', function(err, resp, body) { | |
console.log(err); | |
console.log(ns.get('bar')); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment