undici 6.21.1 → 6.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,6 +73,20 @@ class Pool extends PoolBase {
73
73
  ? { ...options.interceptors }
74
74
  : undefined
75
75
  this[kFactory] = factory
76
+
77
+ this.on('connectionError', (origin, targets, error) => {
78
+ // If a connection error occurs, we remove the client from the pool,
79
+ // and emit a connectionError event. They will not be re-used.
80
+ // Fixes https://github.com/nodejs/undici/issues/3895
81
+ for (const target of targets) {
82
+ // Do not use kRemoveClient here, as it will close the client,
83
+ // but the client cannot be closed in this state.
84
+ const idx = this[kClients].indexOf(target)
85
+ if (idx !== -1) {
86
+ this[kClients].splice(idx, 1)
87
+ }
88
+ }
89
+ })
76
90
  }
77
91
 
78
92
  [kGetDispatcher] () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici",
3
- "version": "6.21.1",
3
+ "version": "6.21.2",
4
4
  "description": "An HTTP/1.1 client, written from scratch for Node.js",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -28,4 +28,5 @@ declare namespace Interceptors {
28
28
  export function retry(opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
29
29
  export function redirect(opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
30
30
  export function responseError(opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
31
+ export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
31
32
  }