You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current implementation, a cache entry is only deleted when it is requested and it has expired. If the cache entry is never requested, it would never be deleted. Combined with the fact _responseCache has no limit on how many entries it can store, we've got a leak.
if(cacheEntry){if(Date.now()-cacheEntry.requestTimestamp<cacheResponseForSeconds*1000){// Cache entry is still valid, return itreturnPromise.resolve(cacheEntry.response)}else{// Cache entry has expired, so delete it explicitlydeletethis._responseCache[requestFunctionArgumentsJSON]}}
Keep searching for stuff without ending the session, memory usage would steadily increase.
Expected Behavior
There should be an eviction policy in place to get rid of the unwanted cached entries and preferably an upper limit on how many results can be cached. I'd recommend implementing Least Recently Used algorithm.
The text was updated successfully, but these errors were encountered:
Description
In the current implementation, a cache entry is only deleted when it is requested and it has expired. If the cache entry is never requested, it would never be deleted. Combined with the fact
_responseCache
has no limit on how many entries it can store, we've got a leak.Steps to reproduce
Expected Behavior
There should be an eviction policy in place to get rid of the unwanted cached entries and preferably an upper limit on how many results can be cached. I'd recommend implementing Least Recently Used algorithm.
The text was updated successfully, but these errors were encountered: