Browse Source

perf: 优化修改获取Hostname

pull/6880/head
ibuler 3 years ago committed by 老广
parent
commit
f129f99faa
  1. 9
      apps/terminal/startup.py

9
apps/terminal/startup.py

@ -23,9 +23,16 @@ class BaseTerminal(object):
name = f'[{suffix_name}]-{hostname}'
self.name = name
self.interval = 30
self.remote_addr = socket.gethostbyname(hostname)
self.remote_addr = self.get_remote_addr(hostname)
self.type = _type
@staticmethod
def get_remote_addr(hostname):
try:
return socket.gethostbyname(hostname)
except socket.gaierror:
return '127.0.0.1'
def start_heartbeat_thread(self):
print(f'- Start heartbeat thread => ({self.name})')
t = threading.Thread(target=self.start_heartbeat)

Loading…
Cancel
Save