Skip to content

Conversation

@luciotato
Copy link

with links to github repos

@kriskowal
Copy link
Collaborator

Thanks for putting this and wait.for together. This article would be about ten times more valuable if it acknowledged and compared alternatives with promises and @creationix’s own genrun proof-of-concept, and acknowledged the interleaving hazards associated with fibers.

@markcollinscope
Copy link

Hola Lucio,

Como estas?

I'm about to use wait.for - as it is the only thing I've seen that seems to come near to enabling a non-blocking wait for an async operation to complete under node.js.

Just wanted to check a couple of points to make sure I've really go it.

  1. This really is non-blocking - i.e. the node server can process other incoming page requests whilst wait.for hangs around waiting for an asynchronous function to compete - then enables the later code to use the results synchronously.
  2. wait.for expects a function (say asyncFn()) as argument - with parameters to that function call listed after. More importantly it assumes the last argument of asyncFn to be a callback - which is not supplied in the wait.for but is 'put in automatically' by the wait.for implementation...

So bascially for example doing:
[ callback of form callback(err, data) ]
asyncDBOperation(selectStatement, callback)

value = wait.for(asyncDBOperation) ...

value will be the 'data ' part of the callback function.

  1. If that is correct, seems to me you deserve a medal!

I'm on markcollinscope@gmail.com - if you'd rather reply there - it'd be better.

Thanks.

@creationix
Copy link
Owner

@markcollinscope
Copy link

@creationix thanks a lot! Mark.

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.

4 participants