We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03b252a commit a3ec206Copy full SHA for a3ec206
lib/context.js
@@ -24,6 +24,7 @@ const {
24
const MAX_CONTEXT_URLS = 10;
25
26
const INITIAL_CONTEXT_CACHE = new Map();
27
+const INITIAL_CONTEXT_CACHE_MAX_SIZE = 10000;
28
29
const api = {};
30
module.exports = api;
@@ -646,6 +647,9 @@ api.getInitialContext = (options) => {
646
647
getInverse: _createInverseContext,
648
clone: _cloneActiveContext
649
};
650
+ if(INITIAL_CONTEXT_CACHE.size === INITIAL_CONTEXT_CACHE_MAX_SIZE) {
651
+ INITIAL_CONTEXT_CACHE.delete(INITIAL_CONTEXT_CACHE.keys().next().value);
652
+ }
653
INITIAL_CONTEXT_CACHE.set(key, initialContext);
654
return initialContext;
655
0 commit comments