On Wed, Jun 7, 2023 at 5:13 AM Kishan Pandey <
pandey....@gmail.com> wrote:
>
> My application is using gorm to connect to the database FQDN. If I am making changes to DNS record for the FQDN , the application needs to be restarted to take the DNS change. I think it is making the DNS query only at the application start time but not afterward.
>
> I would like to know how does golang manages the DNS changes. I looked at gorm issue and found one comment stating that gorm does not manage DNS cache its usage system default.
The Go standard library doesn't cache DNS lookups. If you look up a
name twice, it will generate two different DNS requests, or two
different calls to getaddrinfo. That is, Go expects to be contacting
a caching resolver. Of course, a Go program can do a DNS lookup and
cache the results outside of the standard library.
So while I don't know what problem you are encountering, it doesn't
seem likely to be in the Go standard library.
Ian