Destroys every keep-alive agent pair the transport holds: every cached
custom agent pair, every pair evicted while requests may still have been
in flight, and the shared default http/https pair bound to
axiosClient. Clears the cache so long-lived processes can release
sockets on demand, including the default path's idle sockets, which
would otherwise linger until the upstream keep-alive timeout closes
them. Intended for tests and explicit teardown.
The default pair is rebuilt lazily: the next request re-creates fresh
default agents and rebinds axiosClient to them (see
ensureDefaultAgents), so the default path keeps working after a
teardown without allocating anything at teardown time.
Must not be called while requests are in flight, whether they use
default or customized agents. The agents are shared across requests
with identical maxSockets/maxFreeSockets bounds, so destroying them
closes the underlying sockets and can fail concurrent requests that are
still draining over those sockets. Call this only after all in-flight
requests have settled (for example in a shutdown hook that has awaited
the final request, or in test teardown after the test's assertions).
Calling it twice is safe (the second call iterates an empty cache and
skips the already-destroyed default pair until a request rebuilds it).
Destroys every keep-alive agent pair the transport holds: every cached custom agent pair, every pair evicted while requests may still have been in flight, and the shared default
http/httpspair bound toaxiosClient. Clears the cache so long-lived processes can release sockets on demand, including the default path's idle sockets, which would otherwise linger until the upstream keep-alive timeout closes them. Intended for tests and explicit teardown.The default pair is rebuilt lazily: the next request re-creates fresh default agents and rebinds
axiosClientto them (see ensureDefaultAgents), so the default path keeps working after a teardown without allocating anything at teardown time.Must not be called while requests are in flight, whether they use default or customized agents. The agents are shared across requests with identical
maxSockets/maxFreeSocketsbounds, so destroying them closes the underlying sockets and can fail concurrent requests that are still draining over those sockets. Call this only after all in-flight requests have settled (for example in a shutdown hook that has awaited the final request, or in test teardown after the test's assertions). Calling it twice is safe (the second call iterates an empty cache and skips the already-destroyed default pair until a request rebuilds it).