fixed broken daemon queue thread count
This commit is contained in:
parent
dbd154d450
commit
62200d4d98
@ -53,4 +53,4 @@ def handle_daemon_commands(comm_inst):
|
|||||||
localcommand.local_command(comm_inst._core, 'queueResponseAdd/' + cmd[4], post=True, postData={'data': response})
|
localcommand.local_command(comm_inst._core, 'queueResponseAdd/' + cmd[4], post=True, postData={'data': response})
|
||||||
response = ''
|
response = ''
|
||||||
|
|
||||||
comm_inst.decrementThreadCount('daemonCommands')
|
comm_inst.decrementThreadCount('handle_daemon_commands')
|
@ -52,7 +52,7 @@ class OnionrCommunicatorTimers:
|
|||||||
if self.makeThread:
|
if self.makeThread:
|
||||||
for i in range(self.threadAmount):
|
for i in range(self.threadAmount):
|
||||||
if self.daemonInstance.threadCounts[self.timerFunction.__name__] >= self.maxThreads:
|
if self.daemonInstance.threadCounts[self.timerFunction.__name__] >= self.maxThreads:
|
||||||
logger.debug('%s is currently using the maximum number of threads, not starting another.' % self.timerFunction.__name__)
|
logger.debug('%s is currently using the maximum number of threads, not starting another.' % self.timerFunction.__name__, terminal=True)
|
||||||
else:
|
else:
|
||||||
self.daemonInstance.threadCounts[self.timerFunction.__name__] += 1
|
self.daemonInstance.threadCounts[self.timerFunction.__name__] += 1
|
||||||
newThread = threading.Thread(target=self.timerFunction, args=self.args, daemon=True)
|
newThread = threading.Thread(target=self.timerFunction, args=self.args, daemon=True)
|
||||||
|
@ -25,6 +25,8 @@ from communicator import onlinepeers
|
|||||||
|
|
||||||
def upload_blocks_from_communicator(comm_inst):
|
def upload_blocks_from_communicator(comm_inst):
|
||||||
# when inserting a block, we try to upload it to a few peers to add some deniability
|
# when inserting a block, we try to upload it to a few peers to add some deniability
|
||||||
|
TIMER_NAME = "upload_blocks_from_communicator"
|
||||||
|
|
||||||
triedPeers = []
|
triedPeers = []
|
||||||
finishedUploads = []
|
finishedUploads = []
|
||||||
core = comm_inst._core
|
core = comm_inst._core
|
||||||
@ -32,8 +34,8 @@ def upload_blocks_from_communicator(comm_inst):
|
|||||||
if len(comm_inst.blocksToUpload) != 0:
|
if len(comm_inst.blocksToUpload) != 0:
|
||||||
for bl in comm_inst.blocksToUpload:
|
for bl in comm_inst.blocksToUpload:
|
||||||
if not stringvalidators.validate_hash(bl):
|
if not stringvalidators.validate_hash(bl):
|
||||||
logger.warn('Requested to upload invalid block')
|
logger.warn('Requested to upload invalid block', terminal=True)
|
||||||
comm_inst.decrementThreadCount('uploadBlock')
|
comm_inst.decrementThreadCount(TIMER_NAME)
|
||||||
return
|
return
|
||||||
for i in range(min(len(comm_inst.onlinePeers), 6)):
|
for i in range(min(len(comm_inst.onlinePeers), 6)):
|
||||||
peer = onlinepeers.pick_online_peer(comm_inst)
|
peer = onlinepeers.pick_online_peer(comm_inst)
|
||||||
@ -52,4 +54,4 @@ def upload_blocks_from_communicator(comm_inst):
|
|||||||
comm_inst.blocksToUpload.remove(x)
|
comm_inst.blocksToUpload.remove(x)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
comm_inst.decrementThreadCount('uploadBlock')
|
comm_inst.decrementThreadCount(TIMER_NAME)
|
Loading…
Reference in New Issue
Block a user