Skip to content
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

fix(dns) Fix resolve4 and resolve6 behavior #2144

Merged
merged 3 commits into from
Feb 24, 2023
Merged

Conversation

cirospaciari
Copy link
Collaborator

fix #2098

@cirospaciari cirospaciari marked this pull request as ready for review February 23, 2023 21:12
@cirospaciari cirospaciari changed the title fix(dns) Fix bugs in #2098 fix(dns) Fix resolve4 and resolve6 behavior Feb 23, 2023
@cirospaciari cirospaciari self-assigned this Feb 23, 2023
@@ -535,15 +548,21 @@ export const promises = {
}

resolve(hostname, rrtype) {
return dns.resolve(hostname, rrtype).then(promisifyResolve);
return dns.resolve(hostname, rrtype).then(promisifyResolve(rrtype));
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we generate each of these functions at the top somewhere to avoid the extra function allocation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done in 9aeb64f

if (options?.ttl) {
return dns.lookup(hostname, { family: 4 });
}
return dns.lookup(hostname, { family: 4 }).then((res)=> res?.map(a => a.address))
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we generate each function at the top to avoid the allocation

also make sure you have Prettier configured to run on save (you might need to run bun install somewhere)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done in 9aeb64f

@Jarred-Sumner Jarred-Sumner merged commit d33a53d into main Feb 24, 2023
@Jarred-Sumner Jarred-Sumner deleted the ciro/dns-bugs branch February 24, 2023 21:56
@Jarred-Sumner
Copy link
Collaborator

Thank you

cirospaciari added a commit that referenced this pull request Feb 27, 2023
* fix #2098

* fix last promisifyResolve call

* avoid some functions alloc on dns.exports
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.

node:dns bugs
2 participants