-
-
Notifications
You must be signed in to change notification settings - Fork 37.1k
dns.setServers doesn't play well with async code #1071
Copy link
Copy link
Closed
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.dnsIssues and PRs related to the dns subsystem.Issues and PRs related to the dns subsystem.stalledIssues and PRs manually marked as stalled and scheduled for automatic closure.Issues and PRs manually marked as stalled and scheduled for automatic closure.
Description
Activity
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.dnsIssues and PRs related to the dns subsystem.Issues and PRs related to the dns subsystem.stalledIssues and PRs manually marked as stalled and scheduled for automatic closure.Issues and PRs manually marked as stalled and scheduled for automatic closure.
nodejs/node-v0.x-archive#9243 (comment) led me to realizing that the way
dns.setServersis implemented doesn't play too well with async code.The current target server is stored in a per-app global state, which would probably be fine with sync code, but complicates things if you want to query multiple servers with our async
resolve.I'd propose adding an options object to
resolvecontainingservers, while deprecatingdns.setServersin a major version. I think having an option object onresolvemethods could prove useful later.Note: I haven't checked if c-ares enables per-query target servers easily, maybe @indutny can comment on that part.