fixed broken daemon queue thread count

master
Kevin Froman 2019-07-11 13:26:57 -05:00
parent dbd154d450
commit 62200d4d98
3 changed files with 7 additions and 5 deletions

View File

@ -53,4 +53,4 @@ def handle_daemon_commands(comm_inst):
localcommand.local_command(comm_inst._core, 'queueResponseAdd/' + cmd[4], post=True, postData={'data': response})
response = ''
comm_inst.decrementThreadCount('daemonCommands')
comm_inst.decrementThreadCount('handle_daemon_commands')

View File

@ -52,7 +52,7 @@ class OnionrCommunicatorTimers:
if self.makeThread:
for i in range(self.threadAmount):
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:
self.daemonInstance.threadCounts[self.timerFunction.__name__] += 1
newThread = threading.Thread(target=self.timerFunction, args=self.args, daemon=True)

View File

@ -25,6 +25,8 @@ from communicator import onlinepeers
def upload_blocks_from_communicator(comm_inst):
# when inserting a block, we try to upload it to a few peers to add some deniability
TIMER_NAME = "upload_blocks_from_communicator"
triedPeers = []
finishedUploads = []
core = comm_inst._core
@ -32,8 +34,8 @@ def upload_blocks_from_communicator(comm_inst):
if len(comm_inst.blocksToUpload) != 0:
for bl in comm_inst.blocksToUpload:
if not stringvalidators.validate_hash(bl):
logger.warn('Requested to upload invalid block')
comm_inst.decrementThreadCount('uploadBlock')
logger.warn('Requested to upload invalid block', terminal=True)
comm_inst.decrementThreadCount(TIMER_NAME)
return
for i in range(min(len(comm_inst.onlinePeers), 6)):
peer = onlinepeers.pick_online_peer(comm_inst)
@ -52,4 +54,4 @@ def upload_blocks_from_communicator(comm_inst):
comm_inst.blocksToUpload.remove(x)
except ValueError:
pass
comm_inst.decrementThreadCount('uploadBlock')
comm_inst.decrementThreadCount(TIMER_NAME)