tcollinsworth / axios-cached-dns-resolve

Uses async dns.resolve instead of synchronous dns.lookup, optional cache, and periodic background refreshing
MIT License
39 stars 32 forks source link

Export a `reset()` function to clear active intervals #38

Closed mf-pherlihy closed 1 year ago

mf-pherlihy commented 1 year ago

The backgroundRefreshId and cachePruneId local variables are used to create background refresh intervals behind the scenes. Unfortunately, there is no current way to clear those intervals when we want to clean things up during process termination.

This PR exposes a reset function that will reset these intervals.

tcollinsworth commented 1 year ago

I can add that. Just started using node 20 test runner and discovered the tests hang if background timers are running. That's annoying because ava didn't hang because of background timers. Like not having to use external libs for tests and coverage.

On Tue, Jun 20, 2023 at 3:11 PM Pat Herlihy @.***> wrote:

The backgroundRefreshId and cachePruneId local variables are used to create background refresh intervals behind the scenes. Unfortunately, there is no current way to clear those intervals when we want to clean things up during process termination.

This PR exposes a reset function that will reset these intervals.

You can view, comment on, or merge this pull request online at:

https://github.com/tcollinsworth/axios-cached-dns-resolve/pull/38 Commit Summary

File Changes

(2 files https://github.com/tcollinsworth/axios-cached-dns-resolve/pull/38/files)

Patch Links:

- https://github.com/tcollinsworth/axios-cached-dns-resolve/pull/38.patch

https://github.com/tcollinsworth/axios-cached-dns-resolve/pull/38.diff

— Reply to this email directly, view it on GitHub https://github.com/tcollinsworth/axios-cached-dns-resolve/pull/38, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFYANPVTKG3N3TEXKXX64DXMHYVXANCNFSM6AAAAAAZNW4LOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>