Skip to content

Commit

Permalink
remove variable localization altogether
Browse files Browse the repository at this point in the history
  • Loading branch information
hclivess committed Nov 30, 2019
1 parent b327e11 commit 1edf731
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions connectionmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ 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):

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:
Expand All @@ -33,17 +32,17 @@ 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()
self.mp.MEMPOOL.status()
# 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)
Expand Down Expand Up @@ -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})")

0 comments on commit 1edf731

Please sign in to comment.