mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
flake8 / pylint updates
This commit is contained in:
21
client.py
21
client.py
@@ -5,11 +5,16 @@ import signal
|
||||
from aiortc.contrib.signaling import (add_signaling_arguments,
|
||||
create_signaling)
|
||||
|
||||
from utils.log_utils import logger
|
||||
from utils.log_utils import LOGGER
|
||||
from stream_client import StreamClient
|
||||
from typing import NoReturn
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> NoReturn:
|
||||
"""
|
||||
Reflector's entry point to the python client for WebRTC streaming if not
|
||||
using the browser based UI-application
|
||||
:return:
|
||||
"""
|
||||
parser = argparse.ArgumentParser(description="Data channels ping/pong")
|
||||
|
||||
parser.add_argument(
|
||||
@@ -37,17 +42,17 @@ async def main():
|
||||
|
||||
async def shutdown(signal, loop):
|
||||
"""Cleanup tasks tied to the service's shutdown."""
|
||||
logger.info(f"Received exit signal {signal.name}...")
|
||||
logger.info("Closing database connections")
|
||||
logger.info("Nacking outstanding messages")
|
||||
LOGGER.info(f"Received exit signal {signal.name}...")
|
||||
LOGGER.info("Closing database connections")
|
||||
LOGGER.info("Nacking outstanding messages")
|
||||
tasks = [t for t in asyncio.all_tasks() if t is not
|
||||
asyncio.current_task()]
|
||||
|
||||
[task.cancel() for task in tasks]
|
||||
|
||||
logger.info(f"Cancelling {len(tasks)} outstanding tasks")
|
||||
LOGGER.info(f"Cancelling {len(tasks)} outstanding tasks")
|
||||
await asyncio.gather(*tasks, return_exceptions=True)
|
||||
logger.info(f'{"Flushing metrics"}')
|
||||
LOGGER.info(f'{"Flushing metrics"}')
|
||||
loop.stop()
|
||||
|
||||
signals = (signal.SIGHUP, signal.SIGTERM, signal.SIGINT)
|
||||
|
||||
Reference in New Issue
Block a user