cleanup cleanup code

This commit is contained in:
ericz 2013-02-15 09:20:32 -08:00
parent 37a2d4a950
commit 55e5599428

View File

@ -41,10 +41,6 @@ function PeerServer(options) {
this._setCleanupIntervals();
var self = this;
setInterval(function() {
self._pruneOutstanding();
}, 5000);
};
util.inherits(PeerServer, EventEmitter);
@ -317,11 +313,12 @@ PeerServer.prototype._pruneOutstanding = function() {
}
};
/** Cleanup every 10 mins. */
/** Cleanup */
PeerServer.prototype._setCleanupIntervals = function() {
var self = this;
// Clean up ips every 10 minutes
setInterval(function() {
// Cleanup ips.
var keys = Object.keys(self._ips);
for (var i = 0, ii = keys.length; i < ii; i += 1) {
var key = keys[i];
@ -330,6 +327,11 @@ PeerServer.prototype._setCleanupIntervals = function() {
}
}
}, 600000);
// Clean up outstanding messages every 5 seconds
setInterval(function() {
self._pruneOutstanding();
}, 5000);
};
/** Process outstanding peer offers. */