32 lines
529 B
Python
32 lines
529 B
Python
import asyncio
|
|
from os import getenv
|
|
|
|
import uvloop
|
|
|
|
import util
|
|
|
|
# Use UVLoop
|
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
|
|
|
log = util.get_logger("rts")
|
|
|
|
modules_enabled = getenv("MODULES_ENABLED", False)
|
|
if "rts" not in modules_enabled:
|
|
log.info("RTS disabled.")
|
|
exit(0)
|
|
|
|
|
|
async def main(loop):
|
|
log.info("RTS started.")
|
|
|
|
|
|
loop = asyncio.get_event_loop()
|
|
loop.create_task(main(loop))
|
|
|
|
try:
|
|
loop.run_forever()
|
|
except KeyboardInterrupt:
|
|
log.info("RTS process terminating")
|
|
finally:
|
|
loop.close()
|