Ver Fonte

cleanup cleanup code

ericz há 12 anos atrás
pai
commit
55e5599428
1 ficheiros alterados com 8 adições e 6 exclusões
  1. 8 6
      lib/server.js

+ 8 - 6
lib/server.js

@@ -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. */