Skip to content

Added ability for callbacks to poll promises for fulfillment value#260

Merged
johnhaley81 merged 4 commits into
masterfrom
callback-promises
Nov 11, 2014
Merged

Added ability for callbacks to poll promises for fulfillment value#260
johnhaley81 merged 4 commits into
masterfrom
callback-promises

Conversation

@johnhaley81
Copy link
Copy Markdown
Collaborator

This will allow a callback native to libgit2 to actually have a promise value be returned in the callback eventually. We'll be able to not pause the JS thread while we wait for authentication or any other callback that is triggered from the V8 side.

@johnhaley81
Copy link
Copy Markdown
Collaborator Author

This will need then/promise#58 to be fixed in order for it to work. If they refuse that pull request we might need to switch libraries.

Comment thread test/tests/cred.js
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to return Promises within the tests

@tbranyen
Copy link
Copy Markdown
Member

tbranyen commented Nov 8, 2014

We may want to consider using https://github.com/zenparsing/v8-promise instead. This will more closely model the construct we'll use once Node 0.12 lands.

A note: we should also coerce all inbound Promises to this implementation using Promise.cast.

@johnhaley81
Copy link
Copy Markdown
Collaborator Author

v8-promise doesn't have sync-polling of a promise however. :(

@johnhaley81
Copy link
Copy Markdown
Collaborator Author

I'm leaning towards Q right now. It seems like it could slip into promisify-node pretty easily and has the sync polling that we need. What do you think @tbranyen?

@johnhaley81 johnhaley81 force-pushed the callback-promises branch 2 times, most recently from e3c1df1 to 356bccc Compare November 11, 2014 21:58
@johnhaley81
Copy link
Copy Markdown
Collaborator Author

We finally settled on forking then/promise into a new repo nodegit/promise and using that in promisify-node.

@tbranyen
Copy link
Copy Markdown
Member

This makes me wonder if we should keep promisify-node generic and fork it to nodegit as well?

@johnhaley81
Copy link
Copy Markdown
Collaborator Author

We can do that. Keep all of nodegit's stuff in this org.

johnhaley81 added a commit that referenced this pull request Nov 11, 2014
Added ability for callbacks to poll promises for fulfillment value
@johnhaley81 johnhaley81 merged commit 83ee7e0 into master Nov 11, 2014
@johnhaley81 johnhaley81 deleted the callback-promises branch November 11, 2014 23:20
@johnhaley81 johnhaley81 restored the callback-promises branch November 12, 2014 00:54
@maxkoryukov
Copy link
Copy Markdown

I still don't understand, why not to use the Bluebird-lib?

@johnhaley81
Copy link
Copy Markdown
Collaborator Author

This PR is superseded by #854

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