Commit Graph

10 Commits

Author SHA1 Message Date
Estrella Pan
fa24ec4e2a fix(core): stop blocking the event loop in OpenAI parsing and static routing
OpenAIParser now uses AsyncOpenAI — the previous sync SDK call ran directly
on the event loop (submitting to a ThreadPoolExecutor and immediately
blocking on .result() serialized it anyway). TitleParser.raw_parser and its
callers become async accordingly.

The SPA catch-all route listed dist/ on every request; snapshot it once at
startup. The module-level bangumi TTL cache is now lock-guarded — it is
written from asyncio.to_thread workers in notification paths while the event
loop reads it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 11:39:10 +02:00
Estrella Pan
41298f2f8e fix(backend): improve database migrations, parsers, and network handling
Database:
- Add error handling and per-step version tracking in migrations
- Enable SQLite foreign keys via PRAGMA on connect
- Fix SQLAlchemy .is_(None) usage, add session.merge() for detached
- Batch commit for semantic alias merges
- Quote table/field names in fill-null-defaults SQL
- Guard against empty user data in migration

Parsers:
- TMDB: bounded LRU cache (512), asyncio.gather for parallel season
  fetches, fix season regex \d -> \d+, null-safe year, fix id shadowing
- Raw parser: re.escape() for group/prefix regex, None guard on match
- OpenAI: handle Pydantic model_dump, catch ValueError

Network:
- Null-safe get_html() return
- Error handling per RSS item in mikan parser
- Progressive retry delays (5/15/45/120/300s) with specific exceptions
- Platform detection via sys.platform instead of path heuristic
- Move filter cache to instance variable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:46:35 +01:00
Estrella Pan
5f604e94fd perf(logging): optimize logging with rotation, async I/O, and lazy formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:10:56 +01:00
Leohearts
61c071e035 [fix] better json parsing in openai.py (#913)
Thanks for the contribution\! This fix helps users who use alternative GPT APIs like Moonshot that don't support structured output mode. 🎉
2026-01-25 22:12:38 +01:00
EstrellaXD
1ed87b3dfd fix: secure problem, openai.py 2025-04-29 15:05:25 +02:00
EstrellaXD
d5b84b9085 fix: test openai problem. 2024-09-23 18:09:16 +08:00
100gle
c7c4187807 chore: simplify dict typing 2023-10-08 19:11:13 +08:00
100gle
94a32b3af3 feat(openai): support azure openai 2023-10-08 16:15:16 +08:00
100gle
9b673e3f48 bugfix(openai): replace event loop with ThreadPoolExecutor 2023-10-08 14:05:43 +08:00
100gle
f2db6542ad chore: move openai module to analyser module 2023-10-01 20:59:09 +08:00