maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
727 stars 58 forks source link

Question about iced and continuation local storage. #124

Closed jfgorski closed 10 years ago

jfgorski commented 10 years ago

I'm trying to use the node.js module continuation-local-storage with iced. It looks like namespaces get lost track of unless I add a bind to the defer, e.g.

await User.findOne({ _id: user }).exec cls.getNamespace('session').bind(defer err, user)

You know if there's a better way to make CLS work?

jfgorski commented 10 years ago

I did some digging and, with apologies, it's not iced. The defer callback is going into Mongoose (layer over plain Mongodb lib) which puts it in it's own promise lib which sticks it in an event emitter, which CLS appears not to cover automatically.