]> git.ipfire.org Git - ipfire.org.git/commitdiff
ipfire.org-webapp: Wrap everything into asyncio.run()
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Jul 2023 14:00:20 +0000 (14:00 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Jul 2023 14:00:20 +0000 (14:00 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/scripts/ipfire.org-webapp.in

index 77271cf89ade36a6f2a52815f6d559c5dcb5431a..0c8a0e7ff50fe69ce4af837074b30ed4aec61466 100755 (executable)
@@ -1,6 +1,6 @@
 #!@PYTHON@
 
-import tornado.ioloop
+import asyncio
 import tornado.options
 
 tornado.options.define("debug", type=bool, default=False, help="Enable debug mode")
@@ -8,7 +8,7 @@ tornado.options.define("port", type=int, default=8001, help="Port to listen on")
 
 from ipfire.web import Application
 
-def run():
+async def run():
        tornado.options.parse_command_line()
 
        # Initialize application
@@ -16,7 +16,8 @@ def run():
                debug=tornado.options.options.debug)
        app.listen(tornado.options.options.port, xheaders=True)
 
-       # Launch IOLoop
-       tornado.ioloop.IOLoop.current().start()
+       # Wait for forever
+       await asyncio.Event().wait()
 
-run()
+# Wrap everything in an event loop
+asyncio.run(run())