Skip to content

Commit

Permalink
fix: only delete endpoint which has expired in EndpointCache (#3752)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored May 5, 2021
1 parent 9b68a90 commit 18ac9eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-EndpointCache-1e794ec2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "EndpointCache",
"description": "Only delete endpoint which has expired in EndpointCache"
}
9 changes: 6 additions & 3 deletions vendor/endpoint-cache/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ var EndpointCache = /** @class */ (function () {
var now = Date.now();
var records = this.cache.get(keyString);
if (records) {
for (var i = 0; i < records.length; i++) {
for (var i = records.length-1; i >= 0; i--) {
var record = records[i];
if (record.Expire < now) {
this.cache.remove(keyString);
return undefined;
records.splice(i, 1);
}
}
if (records.length === 0) {
this.cache.remove(keyString);
return undefined;
}
}
return records;
};
Expand Down

0 comments on commit 18ac9eb

Please sign in to comment.