From 43d3f7c08775d518c25dc59f310044d04d437799 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 27 Mar 2018 16:07:55 -0400 Subject: [PATCH] add concurrent_announcers to config --- lbrynet/conf.py | 3 +++ lbrynet/dht/hashannouncer.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lbrynet/conf.py b/lbrynet/conf.py index cbeaac87f..b68d04b80 100644 --- a/lbrynet/conf.py +++ b/lbrynet/conf.py @@ -40,6 +40,8 @@ ANDROID = 4 KB = 2 ** 10 MB = 2 ** 20 +DEFAULT_CONCURRENT_ANNOUNCERS = 25 + DEFAULT_DHT_NODES = [ ('lbrynet1.lbry.io', 4444), ('lbrynet2.lbry.io', 4444), @@ -263,6 +265,7 @@ ADJUSTABLE_SETTINGS = { 'download_timeout': (int, 180), 'is_generous_host': (bool, True), 'announce_head_blobs_only': (bool, True), + 'concurrent_announcers': (int, DEFAULT_CONCURRENT_ANNOUNCERS), 'known_dht_nodes': (list, DEFAULT_DHT_NODES, server_list), 'lbryum_wallet_dir': (str, default_lbryum_dir), 'max_connections_per_stream': (int, 5), diff --git a/lbrynet/dht/hashannouncer.py b/lbrynet/dht/hashannouncer.py index 957725e83..3a4953ac6 100644 --- a/lbrynet/dht/hashannouncer.py +++ b/lbrynet/dht/hashannouncer.py @@ -3,18 +3,19 @@ import logging from twisted.internet import defer, task from lbrynet.core import utils +from lbrynet import conf log = logging.getLogger(__name__) class DHTHashAnnouncer(object): - def __init__(self, dht_node, storage, concurrent_announcers=25): + def __init__(self, dht_node, storage, concurrent_announcers=None): self.dht_node = dht_node self.storage = storage self.clock = dht_node.clock self.peer_port = dht_node.peerPort self.hash_queue = [] - self.concurrent_announcers = concurrent_announcers + self.concurrent_announcers = concurrent_announcers or conf.settings['concurrent_announcers'] self._manage_lc = task.LoopingCall(self.manage) self._manage_lc.clock = self.clock