perf: static file fast path + remove info() log on every request

- Add fast path in processorResource._handle() for static assets (.js/.css/.png/.jpg/.gif/.ico/.svg/.woff etc)
  Static files skip auth closures, i18n, url2processor, isHtml overhead
- Remove info() call in checkAuth() middleware that logged on EVERY request
  (was causing disk flush on every request, blocking the async event loop)
- Log output now only uses debug() for timecost, exception() for errors
This commit is contained in:
yumoqing 2026-05-26 13:18:32 +08:00
parent 8efae163b8
commit 574ef00881
30 changed files with 9 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -163,7 +163,6 @@ class AuthAPI:
@web.middleware
async def checkAuth(self,request, handler):
info(f'checkAuth() called ... {request.path=}, {request.method}, {type(handler)}')
t1 = time.time()
path = request.path
userinfo = await get_session_userinfo(request)

View File

@ -202,6 +202,15 @@ class ProcessorResource(StaticResource,Url2File):
async def _handle(self,request:Request) -> StreamResponse:
# Fast path for static assets: skip auth closures, i18n, url2processor, isHtml
static_exts = ('.js', '.css', '.png', '.jpg', '.jpeg', '.gif', '.ico',
'.svg', '.woff', '.woff2', '.ttf', '.eot', '.map',
'.webp', '.bmp', '.mp3', '.mp4', '.webm', '.ogg', '.wav')
path_lower = request.path.lower()
if any(path_lower.endswith(ext) for ext in static_exts):
self.parse_request(request)
return await super()._handle(request)
clientkeys = {
"iPhone":"iphone",
"iPad":"ipad",