fetch icon indicating copy to clipboard operation
fetch copied to clipboard

Allow passing configurable minimumCacheTime through to dns-cached-resolve

Open sandinmyjoints opened this issue 4 years ago • 3 comments

https://github.com/zeit/dns-cached-resolve/ defaults to 300s, which could be problematic with records with lower ttls. For example, AWS ELBs always use 60s.

This would require a change to https://github.com/zeit/fetch-cached-dns/ as well, I believe.

sandinmyjoints avatar Nov 06 '19 19:11 sandinmyjoints

An alternative way to cope with it could be to invalidate the cached IP in case it doesn't work anymore. It's quite a lost battle but https://00f.net/2019/11/03/stop-using-low-dns-ttls/

Since we are again facing the same issue that a change in multiple repos is needed, I'm again proposing monorepoizing @zeit/fetch.

OlliV avatar Nov 07 '19 18:11 OlliV

Is it possible to invalidate it from this lib as-is, or are you offering that as an alternate approach to take going forward? It sounds fine to me--would solve for our use case.

I've read that article too, but AWS ¯\(ツ)

sandinmyjoints avatar Nov 08 '19 14:11 sandinmyjoints

It's theoretically possible. IIRC, you can register an error handler with @zeit/fetch and then you might be able to dig your way into the dns resolver and ask it to refresh in the error handler: https://github.com/zeit/dns-cached-resolve/blob/master/src/dns-resolve.ts#L14

So what I mean is that an alternative could be to implement an automatic DNS refresh in case of a network error.

However, I think it would be a good idea to implement your original proposal as well.

OlliV avatar Nov 12 '19 00:11 OlliV

Thank you for the report. We are archiving this project; you can read more details here: https://github.com/vercel/fetch/issues/83

Ethan-Arrowood avatar Nov 09 '23 22:11 Ethan-Arrowood