less intensive blob availability check

This commit is contained in:
Jack Robison 2017-04-21 13:32:59 -04:00
parent 0830c8bde2
commit 1ecb32b3ed

View file

@ -28,7 +28,7 @@ class BlobAvailabilityTracker(object):
def start(self): def start(self):
log.info("Starting %s", self) log.info("Starting %s", self)
self._check_popular.start(30) self._check_popular.start(600)
self._check_mine.start(600) self._check_mine.start(600)
def stop(self): def stop(self):
@ -70,7 +70,7 @@ class BlobAvailabilityTracker(object):
def _get_most_popular(self): def _get_most_popular(self):
dl = [] dl = []
for (hash, _) in self._dht_node.get_most_popular_hashes(100): for (hash, _) in self._dht_node.get_most_popular_hashes(10):
encoded = hash.encode('hex') encoded = hash.encode('hex')
dl.append(self._update_peers_for_blob(encoded)) dl.append(self._update_peers_for_blob(encoded))
return defer.DeferredList(dl) return defer.DeferredList(dl)
@ -87,7 +87,7 @@ class BlobAvailabilityTracker(object):
return defer.DeferredList(dl) return defer.DeferredList(dl)
def sample(blobs): def sample(blobs):
return random.sample(blobs, min(len(blobs), 100)) return random.sample(blobs, min(len(blobs), 10))
start = time.time() start = time.time()
log.debug('==> Updating the peers for my blobs') log.debug('==> Updating the peers for my blobs')