From 1edf731c11e1ab7bcb44f8286252dad7660fd9fe Mon Sep 17 00:00:00 2001 From: HCLivess Date: Sat, 30 Nov 2019 09:50:08 +0100 Subject: [PATCH] remove variable localization altogether --- connectionmanager.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/connectionmanager.py b/connectionmanager.py index 8e42d4d..4524fed 100644 --- a/connectionmanager.py +++ b/connectionmanager.py @@ -7,7 +7,6 @@ class ConnectionManager (threading.Thread): def __init__(self, node, mp): threading.Thread.__init__(self, name="ConnectionManagerThread") self.node = node - self.logger = self.node.logger self.mp = mp def run(self): @@ -15,7 +14,7 @@ def run(self): self.connection_manager() def connection_manager(self): - self.logger.app_log.warning("Status: Starting connection manager") + self.node.logger.app_log.warning("Status: Starting connection manager") until_purge = 0 while not self.node.IS_STOPPING: @@ -33,9 +32,9 @@ def connection_manager(self): if not self.node.is_regnet: # regnet never tries to connect self.node.peers.client_loop(self.node, this_target=worker) - self.logger.app_log.warning(f"Status: Threads at {threading.active_count()} / {self.node.thread_limit}") - self.logger.app_log.info(f"Status: Syncing nodes: {self.node.syncing}") - self.logger.app_log.info(f"Status: Syncing nodes: {len(self.node.syncing)}/3") + self.node.logger.app_log.warning(f"Status: Threads at {threading.active_count()} / {self.node.thread_limit}") + self.node.logger.app_log.info(f"Status: Syncing nodes: {self.node.syncing}") + self.node.logger.app_log.info(f"Status: Syncing nodes: {len(self.node.syncing)}/3") # Status display for Peers related info self.node.peers.status_log() @@ -43,7 +42,7 @@ def connection_manager(self): # last block if self.node.last_block_ago: self.node.last_block_ago = time.time() - int(self.node.last_block_timestamp) - self.logger.app_log.warning(f"Status: Last block {self.node.last_block} was generated " + self.node.logger.app_log.warning(f"Status: Last block {self.node.last_block} was generated " f"{'%.2f' % (self.node.last_block_ago / 60) } minutes ago") # status Hook uptime = int(time.time() - self.node.startup_time) @@ -72,4 +71,4 @@ def connection_manager(self): if not self.node.IS_STOPPING: time.sleep(1) except Exception as e: - self.logger.app_log.warning(f"Error in connection manger ({e})") + self.node.logger.app_log.warning(f"Error in connection manger ({e})")