add concurrent_announcers to config

This commit is contained in:
Jack Robison 2018-03-27 16:07:55 -04:00
parent c5bf64cf0a
commit 43d3f7c087
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 6 additions and 2 deletions

View file

@ -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),

View file

@ -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