Re:Accessing a MySQL database from Node.JS
by ionfish on Monday December 07, 2009 @11:00AM
(#981377)
As the API docs note, wait() can be problematic: "If any other promises are created and made to wait while the first promise waits, the first promise’s wait will not return until all others return. The benefit of this is a simple implementation and the event loop does not get blocked. Disadvantage is the possibility of situations where the promise stack grows infinitely large because promises keep getting created and keep being told to wait()."
You could get around the lack of naturalness by using something like MethodChain [1] to allow you to write code like this:
You could get around the lack of naturalness by using something like MethodChain [1] to allow you to write code like this:
http://jsclass.jcoglan.com/methodchain.html