@nxtedition/nxt-undici 6.4.0 → 6.4.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.
@@ -104,27 +104,24 @@ export default () => (dispatch) => {
104
104
 
105
105
  const hash = HASHER.h32(url.href)
106
106
 
107
- for (let i = 0; i < records.length && record == null; i++) {
107
+ for (let i = 0; i < records.length; i++) {
108
108
  const idx = (hash + i) % records.length
109
109
  if (records[idx].expires >= now && records[idx].timeout < now) {
110
110
  record = records[idx]
111
+ break
111
112
  }
112
113
  }
114
+ }
113
115
 
114
- for (let i = 0; i < records.length && record == null; i++) {
115
- const idx = (hash + i) % records.length
116
- if (records[idx].expires >= now) {
117
- record = records[idx]
118
- }
119
- }
120
- } else {
116
+ if (record == null) {
121
117
  records.sort(
122
118
  (a, b) => a.errored - b.errored || a.pending - b.pending || a.counter - b.counter,
123
119
  )
124
120
 
125
- for (let i = 0; i < records.length && record == null; i++) {
121
+ for (let i = 0; i < records.length; i++) {
126
122
  if (records[i].expires >= now) {
127
123
  record = records[i]
124
+ break
128
125
  }
129
126
  }
130
127
  }
@@ -175,6 +175,8 @@ class Handler extends DecoratorHandler {
175
175
  this.#pos += chunk.byteLength
176
176
  }
177
177
 
178
+ this.#retryCount = 0
179
+
178
180
  if (this.#statusCode < 400) {
179
181
  return super.onData(chunk)
180
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "6.4.0",
3
+ "version": "6.4.2",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",