+ Now log running seconds in heartbeat

* Do not spam "could not connect to any peer" if we have a peer connected
master
Kevin Froman 2018-06-26 00:26:01 -05:00
parent 6fd0f9aded
commit 92b0ad975f
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
1 changed files with 5 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class OnionrCommunicatorDaemon:
self.powSalt = 0 self.powSalt = 0
self.delay = 1 self.delay = 1
self.proxyPort = sys.argv[2] self.proxyPort = sys.argv[2]
self.startTime = self._core._utils.getEpoch()
self.onlinePeers = [] self.onlinePeers = []
self.offlinePeers = [] self.offlinePeers = []
@ -223,7 +224,8 @@ class OnionrCommunicatorDaemon:
tried.append(address) tried.append(address)
logger.debug('failed to connect to ' + address) logger.debug('failed to connect to ' + address)
else: else:
logger.warn('Could not connect to any peer') if len(self.onlinePeers) == 0:
logger.warn('Could not connect to any peer')
return retData return retData
def printOnlinePeers(self): def printOnlinePeers(self):
@ -253,7 +255,8 @@ class OnionrCommunicatorDaemon:
def heartbeat(self): def heartbeat(self):
'''Show a heartbeat debug message''' '''Show a heartbeat debug message'''
logger.debug('Communicator heartbeat') currentTime = self._core._utils.getEpoch() - self.startTime
logger.debug('heartbeat, running seconds: ' + str(currentTime))
self.decrementThreadCount('heartbeat') self.decrementThreadCount('heartbeat')
def daemonCommands(self): def daemonCommands(self):