Use aiohttp-fast-url-dispatcher to avoid linear searching to route urls (#4705)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Paulus Schoutsen 2023-11-16 16:52:31 -05:00 committed by GitHub
parent cca74da1f3
commit 030527a4f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -1,5 +1,6 @@
aiodns==3.1.1 aiodns==3.1.1
aiohttp==3.8.6 aiohttp==3.8.6
aiohttp-fast-url-dispatcher==0.1.0
async_timeout==4.0.3 async_timeout==4.0.3
atomicwrites-homeassistant==1.4.1 atomicwrites-homeassistant==1.4.1
attrs==23.1.0 attrs==23.1.0

View File

@ -5,6 +5,7 @@ from pathlib import Path
from typing import Any from typing import Any
from aiohttp import web from aiohttp import web
from aiohttp_fast_url_dispatcher import FastUrlDispatcher, attach_fast_url_dispatcher
from ..const import AddonState from ..const import AddonState
from ..coresys import CoreSys, CoreSysAttributes from ..coresys import CoreSys, CoreSysAttributes
@ -64,6 +65,7 @@ class RestAPI(CoreSysAttributes):
"max_field_size": MAX_LINE_SIZE, "max_field_size": MAX_LINE_SIZE,
}, },
) )
attach_fast_url_dispatcher(self.webapp, FastUrlDispatcher())
# service stuff # service stuff
self._runner: web.AppRunner = web.AppRunner(self.webapp) self._runner: web.AppRunner = web.AppRunner(self.webapp)