Add lru-cache dependency; make remote._received_tx an lru-cache with specified max length

This commit is contained in:
wltsmrz
2014-02-19 13:00:38 -08:00
parent 5ca5c73c34
commit 573b38cc19
2 changed files with 6 additions and 4 deletions

View File

@@ -12,10 +12,11 @@
"test": "test"
},
"dependencies": {
"async": "~0.2.9",
"async": "~0.2.10",
"ws": "~0.4.31",
"extend": "~1.2.1",
"jshint-loader": "~0.5.0"
"jshint-loader": "~0.5.0",
"lru-cache": "~2.5.0"
},
"devDependencies": {
"grunt": "~0.4.1",
@@ -26,7 +27,7 @@
"grunt-dox": "~0.5.0",
"mocha": "~1.14.0",
"sinon-chai": "~2.4.0",
"sinon":"~1.7.3"
"sinon": "~1.7.3"
},
"scripts": {
"pretest": "node_modules/.bin/grunt",

View File

@@ -15,6 +15,7 @@
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var LRU = require('lru-cache');
var Request = require('./request').Request;
var Server = require('./server').Server;
var Amount = require('./amount').Amount;
@@ -101,7 +102,7 @@ function Remote(opts, trace) {
this._connection_offset = 1000 * (typeof opts.connection_offset === 'number' ? opts.connection_offset : 5)
this._submission_timeout = 1000 * (typeof opts.submission_timeout === 'number' ? opts.submission_timeout : 10)
this._received_tx = { };
this._received_tx = LRU({ max: 10 });
this._cur_path_find = null;
// Local signing implies local fees and sequences