simplify external ip logic
This commit is contained in:
parent
050b67c9d6
commit
5394f1763c
2 changed files with 2 additions and 4 deletions
|
@ -127,16 +127,14 @@ class AnalyticsManager:
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
if self.task is None:
|
if self.task is None:
|
||||||
self.external_ip = await utils.get_external_ip() if self.enabled else None
|
|
||||||
self.task = asyncio.create_task(self.run())
|
self.task = asyncio.create_task(self.run())
|
||||||
|
|
||||||
async def run(self):
|
async def run(self):
|
||||||
while True:
|
while True:
|
||||||
if self.enabled:
|
if self.enabled:
|
||||||
|
self.external_ip = await utils.get_external_ip()
|
||||||
await self._send_heartbeat()
|
await self._send_heartbeat()
|
||||||
await asyncio.sleep(1800)
|
await asyncio.sleep(1800)
|
||||||
if self.enabled:
|
|
||||||
self.external_ip = await utils.get_external_ip()
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
if self.task is not None and not self.task.done():
|
if self.task is not None and not self.task.done():
|
||||||
|
|
|
@ -51,7 +51,7 @@ class HTTPSLogglyHandler(logging.Handler):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def enabled(self):
|
def enabled(self):
|
||||||
return self._toggle is None or (self._toggle and self._toggle())
|
return self._toggle and self._toggle()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_full_message(record):
|
def get_full_message(record):
|
||||||
|
|
Loading…
Reference in a new issue