-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Use native promises and async/await, drop bluebird and promisify-any #190
Conversation
@Uzlopak @HappyZombies @jorenvandeweyer friendly ping - would one of you be willing to take a look at this one, maybe discuss details? I am still unsure if dropping callback support entirely is a good thing, we have already some dependants that might want a slower transition. We basically have two options: A - remove callback support (as already done in this PR) and immediately bump a major step to 5.0.0 (but provide an rc release first to allow early adopters to test) B - An alternative would be to keep callback support for now and raise a warning that it will be removed in the next major version? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favour of removing callback support and releasing a 5.0.0-rc.0
.
This makes the transition to typescript a lot easier!
I do see something inconsistent in the PR.
Sometimes the Promise.all
is replaced by a chain of awaits and sometimes it's not. Maybe we can remove all Promise.all
functions?
@jorenvandeweyer thanks a lot for your opinion on this and the hint to the Regarding the callbacks - I tend towards this approach, too! Regarding Promise.all - I will remove them entirely. I also think there were issues with Promise race conditions by using Promise.all (mentioned deep in the conversations of one of the issues....). Replacing this with chains of awaits woulf automatically prevent unintended execution order. |
@HappyZombies @Uzlopak do you generally agree with the aforementioned proceeding?
If this is merged I would publish |
@HappyZombies @Uzlopak @jorenvandeweyer some update on this. I manually wrote a few emails to repo owners that I found in our dependants list. I asked them about their perspective on this and the vast majority is fine with going full async and dropping callbacks in 5.x. I will therefore continue the proposed strategy and release the |
@jankapunkt thanks for reaching out to devs about this. Although I think it might be possible to support both promise and a callback (I have seen this before in other modules I've used), it's obviously just more effort. If we're good with removing callback support entirely, then let's do it 👍 |
Summary
This is a breaking change!
async/await
in favour ofPromise
where applicablePromise.
calls in async functions with native behaviourawait
chain instead ofPromise.all
Promise.reject
Promise.resolve
Promise.resolve
in combination with sinon stubs but that's because in this case the pattern is more concise than anasync
function counterpartRelation to the prior PR
There was a prior PR that did basically the same as this one: #107
The
development
branch became too different from #107 and the merge diff was unbearable to read. I closed #107 and used it as blueprint to implement it from the latestdevelopment
state.Release proposal
If this gets accepted and merged we should create a
5.0.0-rc.0
release to allow early adopters to integrate and report any issues beyond the expected ones. Please comment.Linked issue(s)
#19
#20
#15
#48
Involved parts of the project
Added tests?
OAuth2 standard
Reproduction