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):
|
||||
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())
|
||||
|
||||
async def run(self):
|
||||
while True:
|
||||
if self.enabled:
|
||||
self.external_ip = await utils.get_external_ip()
|
||||
await self._send_heartbeat()
|
||||
await asyncio.sleep(1800)
|
||||
if self.enabled:
|
||||
self.external_ip = await utils.get_external_ip()
|
||||
|
||||
def stop(self):
|
||||
if self.task is not None and not self.task.done():
|
||||
|
|
|
@ -51,7 +51,7 @@ class HTTPSLogglyHandler(logging.Handler):
|
|||
|
||||
@property
|
||||
def enabled(self):
|
||||
return self._toggle is None or (self._toggle and self._toggle())
|
||||
return self._toggle and self._toggle()
|
||||
|
||||
@staticmethod
|
||||
def get_full_message(record):
|
||||
|
|
Loading…
Reference in a new issue