You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the dnsOrder value of the dns module changes, I hope to get the modified value or judge that the value has changed. Therefore, I want to expose getDefaultVerbatim method or expose a new method getDefaultResultOrder.
After I start a node service, if I use getDefaultResultOrder to change the value of dnsOrder or change other contents of the same file, when hot update is triggered at this time, I hope to obtain the value before and after the change through the exposed method to judge whether the order value has changed.
According to the results of the above judgment, I will decide whether to update the local value printed on the terminal.
Maybe I misunderstand you but that seems of really limited utility. Why would it matter if the value changed between reloads? Is it purely a diagnostic?
Yeah, the situation I am currently encountering is mainly to compare the values before and after the change and make some changes.
However, since the logic of changing the dnsOrder value is not in the same file as the logic that requires other processing, I think it would be convenient to dynamically obtain the values before and after the change for comparison.
In addition, it suddenly occurred to me that by comparing the results of dns.promises('localhost') and dns.promises('localhost', { verbatim: true }), it seems that it is possible to determine whether the value of dnsOrder has changed, but some cumbersome.
I understand what you're saying now but I don't know if it passes the bar for inclusion in the standard library. Can I suggest you open a pull request and see how it's received?
I agree with Ben; I think repeatedly switching between verbatim and ipv4first at runtime and being unable to communicate this change within the application is a very niche use case.
Activity
bnoordhuis commentedon Mar 4, 2023
Can you explain why you want to know that? I'm trying to think of reasonable use cases but I'm coming up empty-handed.
To a first approximation, as a library author, you're not expected to care. That's the responsibility of the application.
As an application programmer, you normally configure it at startup and then never change nor care about it later.
btea commentedon Mar 4, 2023
After I start a node service, if I use
getDefaultResultOrderto change the value ofdnsOrderor change other contents of the same file, when hot update is triggered at this time, I hope to obtain the value before and after the change through the exposed method to judge whether the order value has changed.According to the results of the above judgment, I will decide whether to update the local value printed on the terminal.
bnoordhuis commentedon Mar 4, 2023
Maybe I misunderstand you but that seems of really limited utility. Why would it matter if the value changed between reloads? Is it purely a diagnostic?
btea commentedon Mar 5, 2023
Yeah, the situation I am currently encountering is mainly to compare the values before and after the change and make some changes.
However, since the logic of changing the dnsOrder value is not in the same file as the logic that requires other processing, I think it would be convenient to dynamically obtain the values before and after the change for comparison.
In addition, it suddenly occurred to me that by comparing the results of
dns.promises('localhost')anddns.promises('localhost', { verbatim: true }), it seems that it is possible to determine whether the value ofdnsOrderhas changed, but some cumbersome.bnoordhuis commentedon Mar 5, 2023
I understand what you're saying now but I don't know if it passes the bar for inclusion in the standard library. Can I suggest you open a pull request and see how it's received?
tniessen commentedon Mar 5, 2023
I agree with Ben; I think repeatedly switching between
verbatimandipv4firstat runtime and being unable to communicate this change within the application is a very niche use case.btea commentedon Mar 5, 2023
Do you mean to open a pull request to expose the
getDefaultVerbatimmethod or expose a new methodgetDefaultResultOrder?bnoordhuis commentedon Mar 6, 2023
I'll leave that up to you. What you think is best.
btea commentedon Mar 6, 2023
Ok, I created a pr exposing the method
getDefaultResultOrder. It looks like the docs also need to be updated.dns: expose getDefaultResultOrder
dns: expose getDefaultResultOrder
dns: expose getDefaultResultOrder
dns: expose getDefaultResultOrder