Skip to content

Commit b65af73

Browse files
committed
1 parent 164c355 commit b65af73

File tree

6 files changed

+23
-15
lines changed

6 files changed

+23
-15
lines changed

node_modules/lru-cache/dist/commonjs/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,8 @@ class LRUCache {
11631163
const cb = (v, updateCache = false) => {
11641164
const { aborted } = ac.signal;
11651165
const ignoreAbort = options.ignoreFetchAbort && v !== undefined;
1166+
const proceed = options.ignoreFetchAbort ||
1167+
!!(options.allowStaleOnFetchAbort && v !== undefined);
11661168
if (options.status) {
11671169
if (aborted && !updateCache) {
11681170
options.status.fetchAborted = true;
@@ -1175,7 +1177,7 @@ class LRUCache {
11751177
}
11761178
}
11771179
if (aborted && !ignoreAbort && !updateCache) {
1178-
return fetchFail(ac.signal.reason);
1180+
return fetchFail(ac.signal.reason, proceed);
11791181
}
11801182
// either we didn't abort, and are still here, or we did, and ignored
11811183
const bf = p;
@@ -1205,9 +1207,10 @@ class LRUCache {
12051207
options.status.fetchRejected = true;
12061208
options.status.fetchError = er;
12071209
}
1208-
return fetchFail(er);
1210+
// do not pass go, do not collect $200
1211+
return fetchFail(er, false);
12091212
};
1210-
const fetchFail = (er) => {
1213+
const fetchFail = (er, proceed) => {
12111214
const { aborted } = ac.signal;
12121215
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
12131216
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
@@ -1216,7 +1219,8 @@ class LRUCache {
12161219
if (this.#valList[index] === p) {
12171220
// if we allow stale on fetch rejections, then we need to ensure that
12181221
// the stale value is not removed from the cache when the fetch fails.
1219-
const del = !noDelete || bf.__staleWhileFetching === undefined;
1222+
const del = !noDelete ||
1223+
!proceed && bf.__staleWhileFetching === undefined;
12201224
if (del) {
12211225
this.#delete(k, 'fetch');
12221226
}

node_modules/lru-cache/dist/commonjs/index.min.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

node_modules/lru-cache/dist/esm/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,8 @@ export class LRUCache {
11601160
const cb = (v, updateCache = false) => {
11611161
const { aborted } = ac.signal;
11621162
const ignoreAbort = options.ignoreFetchAbort && v !== undefined;
1163+
const proceed = options.ignoreFetchAbort ||
1164+
!!(options.allowStaleOnFetchAbort && v !== undefined);
11631165
if (options.status) {
11641166
if (aborted && !updateCache) {
11651167
options.status.fetchAborted = true;
@@ -1172,7 +1174,7 @@ export class LRUCache {
11721174
}
11731175
}
11741176
if (aborted && !ignoreAbort && !updateCache) {
1175-
return fetchFail(ac.signal.reason);
1177+
return fetchFail(ac.signal.reason, proceed);
11761178
}
11771179
// either we didn't abort, and are still here, or we did, and ignored
11781180
const bf = p;
@@ -1202,9 +1204,10 @@ export class LRUCache {
12021204
options.status.fetchRejected = true;
12031205
options.status.fetchError = er;
12041206
}
1205-
return fetchFail(er);
1207+
// do not pass go, do not collect $200
1208+
return fetchFail(er, false);
12061209
};
1207-
const fetchFail = (er) => {
1210+
const fetchFail = (er, proceed) => {
12081211
const { aborted } = ac.signal;
12091212
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
12101213
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
@@ -1213,7 +1216,8 @@ export class LRUCache {
12131216
if (this.#valList[index] === p) {
12141217
// if we allow stale on fetch rejections, then we need to ensure that
12151218
// the stale value is not removed from the cache when the fetch fails.
1216-
const del = !noDelete || bf.__staleWhileFetching === undefined;
1219+
const del = !noDelete ||
1220+
!proceed && bf.__staleWhileFetching === undefined;
12171221
if (del) {
12181222
this.#delete(k, 'fetch');
12191223
}

0 commit comments

Comments
 (0)