fix: address code review findings

- Add retry (2 attempts) on CivitAI 429 rate limit instead of silently skipping
- Use check_same_thread=False for SQLite connection (aiohttp context)
- Add debug logging to silent exception handlers in proxy

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 14:44:12 +01:00
parent 63ddaaa70d
commit f6e39df157
3 changed files with 24 additions and 21 deletions
+4 -4
View File
@@ -599,8 +599,8 @@ async def lm_remote_proxy_middleware(request: web.Request, handler):
body = json.loads(response.body)
enriched = _enrich_list_response(body)
return web.json_response(enriched)
except Exception:
pass # Return original response on any error
except Exception as exc:
logger.debug("[LM-Remote] Stats enrichment failed: %s", exc)
# Inject stats UI script into HTML pages
if (path in _PROXY_PAGE_ROUTES or path.rstrip("/") in _PROXY_PAGE_ROUTES):
if response.status == 200:
@@ -616,8 +616,8 @@ async def lm_remote_proxy_middleware(request: web.Request, handler):
charset="utf-8",
status=response.status,
)
except Exception:
pass
except Exception as exc:
logger.debug("[LM-Remote] HTML injection failed: %s", exc)
return response
# Not a LoRA Manager route — fall through