Skip to content

Commit 7a324bd

Browse files
committed
fix(endpoint-discovery): delete failed cache entry in blocking operations
1 parent 8fe1b54 commit 7a324bd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/middleware-endpoint-discovery/src/updateDiscoveredEndpointInCache.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ export const updateDiscoveredEndpointInCache = async (
7676
}
7777

7878
if (options.isDiscoveredEndpointRequired) {
79+
// The cache entry must be deleted in this case
80+
// because a subsequent blocking request will be stuck
81+
// in a waiting state if it sees the cache entry
82+
// but we have already flushed the request queue.
83+
endpointCache.delete(cacheKey);
7984
reject(errorToThrow);
8085
} else {
8186
// Endpoint Discovery is optional. No error needs to be thrown.

0 commit comments

Comments
 (0)