-
-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support async recipes #305
Conversation
I've added tests for the two basic cases:
If anyone has more test ideas, please speak up! |
Great stuff! Will review in details next week, but the Promise support is an extremely useful feature! I can update the typings and docs as well. I might add a bit of refactoring on top of this, to also expose the lower level api as proposed in #302,
P.S.: you do have the permissions to directly create branches on this repository, which makes it possible to both commit to the same branch :) |
True! I would do that, but I would need to reopen this PR. Note that "Allow edits from maintainers" is enabled! ;) |
240467a
to
addca15
Compare
questions that just popped up in my mind: does this affect |
Definitely not for |
For recursive use after During the finalize phase, we need to track how many unowned drafts will exist in the returned copy. We would only be able to auto-freeze the result if no unowned drafts are found. edit: Working on a fix for this.. |
Note: With async recipe functions, it remains unsafe to "hoist" drafts out of the recipe, since they can be revoked at any time. |
also note that in that sense it also can' t be used to solve the lowlevel
proposal in 302; as finalizing would always happen on at least one tick
later; when the promise settles
Op do 31 jan. 2019 om 16:37 schreef Alec Larson <notifications@github.com>:
… Note: When using an async recipe function, you're free to "hoist" drafts
out of their recipe function, since they'll definitely be finalized when
the promise is resolved. But it remains unsafe to do the same with a
synchronous recipe function.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#305 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhG-CgmvZi0yduz15Fn6tEJmqJp3Cks5vIw2dgaJpZM4abRWX>
.
|
I don't think so, because you're not required to use promises when deferring the finalize phase. I've separated that logic into the |
ah, that is awesome @aleclarson! |
Note: With the current implementation, you wouldn't be able to call |
The issue mentioned in #305 (comment) has been fixed. 🎉 |
Note: With e280946, unowned drafts will only prevent auto-freezing of affected "branches". Branches which contain no unowned drafts will be safely auto-frozen! 👍 Previously, a nested |
Drafts won't be revoked until the returned promise is fulfilled or rejected.
@mweststrate Node 6 doesn't support async/await, so the tests are failing. Maybe we should drop Node 6 support? :P |
THAT would be a breaking change after all haha |
Closed MR in favor of #307 (which is the same, but on this repo) |
@mweststrate Were you having trouble editing this PR? Or just want to avoid adding another git remote? |
The latter, wasn't sure yet whether to use one or two branches. But changes
are so small so far I'll keep it as one
Op za 2 feb. 2019 14:34 schreef Alec Larson <notifications@github.com:
… @mweststrate <https://github.com/mweststrate> Were you having trouble
editing this PR? Or just want to avoid adding another git remote?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#305 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhNoMwwT5f8jhu3U98kjvZ__oTeI9ks5vJZPogaJpZM4abRWX>
.
|
Drafts won't be revoked until the returned promise is fulfilled or rejected.
The readme needs to be updated to reflect this. Anyone willing to contribute here?
As suggested by @Yurickh in #302 (comment)