Skip to content

Commit

Permalink
DocSzCache size is now configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
roonyh committed Jun 28, 2016
1 parent 2824eb5 commit 5b516c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/environment_variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,9 @@ Kadira._parseEnv._options = {
name: 'proxy',
parser: Kadira._parseEnv.parseUrl,
},
// number of items cached for tracking document size
KADIRA_OPTIONS_DOCUMENT_SIZE_CACHE_SIZE: {
name: 'documentSizeCacheSize',
parser: Kadira._parseEnv.parseInt,
},
};
7 changes: 6 additions & 1 deletion lib/kadira.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Kadira.models.pubsub = new PubsubModel();
Kadira.models.system = new SystemModel();
Kadira.docSzCache = new DocSzCache(100000, 10);


Kadira.connect = function(appId, appSecret, options) {
options = options || {};
options.appId = appId;
Expand All @@ -32,6 +31,12 @@ Kadira.connect = function(appId, appSecret, options) {
options.hostname = options.hostname || hostname;
options.proxy = options.proxy || null;

if(options.documentSizeCacheSize) {
Kadira.docSzCache = new DocSzCache(documentSizeCacheSize, 10);
}

console.log(documentSizeCacheSize);

// remove trailing slash from endpoint url (if any)
if(_.last(options.endpoint) === '/') {
options.endpoint = options.endpoint.substr(0, options.endpoint.length - 1);
Expand Down

0 comments on commit 5b516c4

Please sign in to comment.