Attempt at fix for response hang when the app has been running for long time.
This commit is contained in:
parent
86a52862da
commit
620caf9caa
1 changed files with 9 additions and 4 deletions
13
app/main.py
13
app/main.py
|
|
@ -31,6 +31,7 @@ class Main:
|
||||||
connection: sqlite3.Connection = None
|
connection: sqlite3.Connection = None
|
||||||
queue: DownloadQueue = None
|
queue: DownloadQueue = None
|
||||||
loop: asyncio.AbstractEventLoop = None
|
loop: asyncio.AbstractEventLoop = None
|
||||||
|
appLoader: str = None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.config = Config.get_instance()
|
self.config = Config.get_instance()
|
||||||
|
|
@ -349,10 +350,14 @@ class Main:
|
||||||
|
|
||||||
@self.routes.get(self.config.url_prefix)
|
@self.routes.get(self.config.url_prefix)
|
||||||
async def index(_) -> Response:
|
async def index(_) -> Response:
|
||||||
return web.FileResponse(os.path.join(
|
if not self.appLoader:
|
||||||
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
|
with open(os.path.join(
|
||||||
'frontend/dist/index.html'
|
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
|
||||||
))
|
'frontend/dist/index.html'
|
||||||
|
), 'r') as f:
|
||||||
|
self.appLoader = f.read()
|
||||||
|
|
||||||
|
return web.Response(text=self.appLoader, content_type='text/html', charset='utf-8', status=200)
|
||||||
|
|
||||||
@self.sio.event()
|
@self.sio.event()
|
||||||
async def connect(sid, environ):
|
async def connect(sid, environ):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue