Begin implementing RTS process
This commit is contained in:
parent
1cc2ef629e
commit
352909bec0
31
rts.py
Normal file
31
rts.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
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()
|
Loading…
Reference in New Issue
Block a user