-
Notifications
You must be signed in to change notification settings - Fork 565
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
chore: less async await #2463
chore: less async await #2463
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2463 +/- ##
==========================================
+ Coverage 85.54% 85.62% +0.07%
==========================================
Files 76 77 +1
Lines 6858 7053 +195
==========================================
+ Hits 5867 6039 +172
- Misses 991 1014 +23 ☔ View full report in Codecov by Sentry. |
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.
lgtm
await this[kAgent].close() | ||
await this[kClient].close() | ||
[kClose] () { | ||
return Promise.all([this[kAgent].close, this[kClient].close]) |
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.
@Uzlopak @mcollina @KhafraDev ?:
return Promise.all([this[kAgent].close(), this[kClient].close()])
And 👇🏻
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 searched for [kClose] and the places were it was was not awaited anyway.
@@ -1808,10 +1808,10 @@ async function httpNetworkFetch ( | |||
fetchParams.controller.controller = controller | |||
}, | |||
async pull (controller) { | |||
await pullAlgorithm(controller) | |||
pullAlgorithm(controller) |
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.
!!! This is wrong? needs a return at least?
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.
It was before not returning anything. So it is fire and forget? So why await anyway?
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.
wasn't it at least informing the caller that the operation is done? I'm not sure where this is used, this can't possible cause racing conditions or break someone's tests?
@@ -82,40 +82,38 @@ class ProxyAgent extends DispatcherBase { | |||
this[kClient] = clientFactory(resolvedUrl, { connect }) | |||
this[kAgent] = new Agent({ | |||
...opts, | |||
connect: async (opts, callback) => { | |||
connect: (opts, callback) => { |
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.
this was unnecessary and made it less maintainable...
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.
This one was also questionable for me. But it should save a Promise?
@KhafraDev also ☝️ |
First of all, I expected a little bit more discussion before merging. As the tests pass, I was like: "Ok, seems to be right" and was hoping to get some thoughts, and maybe revert some parts but still get some changes through. |
Done, sorry |
Can you reopen @Uzlopak ? |
I thought that the point of |
This reverts commit e7ab79a.
Why do we use so much async await?
This relates to...
Rationale
Changes
Features
Bug Fixes
Breaking Changes and Deprecations
Status