753525fb41
perf(upload): offload GIF/WebP raw image validation to spawn_blocking
...
GIF 走 image::load_from_memory 会完整解码动画帧,在 async 上下文阻塞
worker。移到 spawn_blocking,JoinError 兜底任务失败。
2026-06-18 11:19:34 +08:00
033b89ccb8
perf(posts): offload Markdown rendering to spawn_blocking
...
create/update/rebuild 三处 Markdown 渲染(含 syntect 高亮)移到阻塞
线程池。rebuild 用 spawn_blocking 的 JoinError 替代 catch_unwind 捕获
渲染 panic,避免单条记录拖垮整批。
2026-06-18 11:18:36 +08:00
45e92795de
refactor(markdown): unify parser options across TOC and HTML passes
...
原先第一遍用 Options::all() 收集 heading,第二遍只用 ENABLE_TABLES
生成 HTML,两遍对扩展语法的处理不一致。统一为 Options::all()。
2026-06-18 11:16:58 +08:00
62600a6687
perf(auth): offload Argon2 hash/verify to spawn_blocking
...
Argon2 是 memory-hard 计算,登录/注册时同步执行会阻塞 Tokio worker
数百毫秒。改为在阻塞线程池执行,JoinError 兜底任务 panic。
2026-06-18 11:16:13 +08:00
79cb809010
perf(posts): add optional pagination to get_posts_by_tag, fix total count
...
- get_posts_by_tag 现接受 page/per_page 可选参数;两者均 None 时返回全部
(上限 200,用于无翻页 UI 的标签详情页),均提供时走标准分页。
- 修正 total:不再用 posts.len(),改为真实 COUNT(*),即使被 LIMIT 截断
也返回完整计数。
- 新增 CacheKey::PostsByTagPage 分页缓存键,与不分页键 PostsByTag 共存。
- 前端 tags.rs 传 (None, None) 保持原全部展示行为。
2026-06-18 11:14:56 +08:00
2dda168b19
perf(db): switch pool recycling method from Verified to Fast
...
Verified 每次取连接都会额外发 SELECT 1 验证;Fast 直接复用,
依赖 tokio-postgres 在使用时自然报错,由 get_conn 的退避重试兜底。
2026-06-18 11:08:14 +08:00
54f7bd481a
perf(db): replace fixed 2s retry with exponential backoff + jitter
...
get_conn 现在按 base*2^attempt + 随机 jitter 退避(200ms 起步),
避免连接池抖动时多请求同步重试形成惊群。
2026-06-18 11:06:57 +08:00
104ff427f9
perf(db): add exponential backoff retry helper with tests
...
引入 src/db/retry.rs,提供 base * 2^attempt + jitter 的退避序列,
取代 pool.rs 中固定 2s 重试。MAX_RETRIES 将在下一个提交中被 get_conn 使用。
2026-06-18 11:05:22 +08:00
306da3cf83
Merge caching and SSR invalidation improvements
CI / check (push) Failing after 24m9s
CI / build (push) Has been skipped
2026-06-18 10:43:40 +08:00
7f372446da
refactor(ssr): restrict X-SSR-Generation header to GET requests and add serial tests
2026-06-18 10:30:12 +08:00
3ee39d910c
refactor(ssr): remove unused per-slug/per-tag generation counters
2026-06-18 10:30:07 +08:00
4c695b4fc3
refactor(tasks): use named constants for MB and hours in cleanup
2026-06-18 10:11:07 +08:00
12355b7859
fix(tasks): skip symlinks during image disk cache cleanup
2026-06-18 10:10:51 +08:00
a71da7473d
perf(image): remove redundant Vec clone before spawn_blocking
2026-06-18 10:10:44 +08:00
0b107c3f2e
feat(tasks): add periodic image disk cache cleanup
2026-06-18 10:03:38 +08:00
36554af5f5
perf(image): store cached image data as Bytes to avoid Vec cloning
2026-06-18 10:03:35 +08:00
411e565465
docs(cache,search): update module and function comments
2026-06-18 09:55:45 +08:00
24bc6f44a0
fix(tasks): invalidate session cache after cleaning expired sessions
2026-06-18 09:55:04 +08:00
518b4e5d64
refactor(auth): store SessionUser instead of full User in session cache
2026-06-18 09:55:00 +08:00
c780247d17
feat(posts): invalidate search cache on writes
2026-06-17 17:21:01 +08:00
c40a771989
feat(search): cache search results with short TTL
2026-06-17 17:20:54 +08:00
1d216faa2f
feat(auth): add in-memory session cache
2026-06-17 17:20:47 +08:00
75b8f80631
fix(posts): wrap empty_trash in transaction and lock rows for precise invalidation
2026-06-17 17:05:07 +08:00
05b9a3a595
feat: enable all HTTP compression algorithms by default
...
CI / check (push) Failing after 14m38s
CI / build (push) Has been skipped
- COMPRESSION_ALGORITHMS defaults to 'all' when unset
- Support 'none'/'off' to explicitly disable compression
- Add parse_compression_algorithms helper and unit tests
- Update .env.example comment to reflect new default
2026-06-17 17:03:17 +08:00
7bd02d0ea9
perf(cache): run tag post invalidations concurrently
2026-06-17 16:59:29 +08:00
2d8f1e0d98
refactor(posts): avoid redundant cache invalidation in bulk fallback paths
2026-06-17 16:59:24 +08:00
c77f751377
refactor(posts): apply precise invalidation limit to batch_restore_posts
2026-06-17 16:59:18 +08:00
ca212a2aab
fix(posts): lock rows and read metadata in transaction for delete/purge/restore
2026-06-17 16:58:54 +08:00
634f733e36
feat: add Cache-Control headers for public pages and static assets
...
- Public SSR pages: public, max-age=300, stale-while-revalidate=3600
- Static assets (/_dioxus/, /wasm/, *.js, *.wasm, style.css, highlight.css): public, max-age=31536000, immutable
- API, admin, auth pages and non-GET/HEAD requests remain uncached
- Add unit tests for cache control path matching
2026-06-17 16:57:42 +08:00
1092fbb3ce
fix(posts): ensure rebuild invalidates tag posts cache
2026-06-17 16:44:32 +08:00
facb75d632
feat: make HTTP compression algorithms configurable via COMPRESSION_ALGORITHMS
CI / check (push) Failing after 6m57s
CI / build (push) Has been skipped
2026-06-17 16:38:41 +08:00
c03093fc8b
refactor(posts): use precise cache invalidation in rebuild
2026-06-17 16:37:20 +08:00
bb34e2c36e
refactor(posts): use precise cache invalidation in trash operations
2026-06-17 16:37:20 +08:00
82b070e7ac
refactor(posts): use precise cache invalidation in create/update/delete
2026-06-17 16:37:20 +08:00
c528936abb
feat(cache): add invalidate_tag_posts_for helper
2026-06-17 16:37:20 +08:00
15e7e2578d
refactor(utils): extract reading_time helper
2026-06-17 16:25:22 +08:00
e683efe0ea
refactor(models): remove dead Post status methods, add PostListItem tests
2026-06-17 16:24:50 +08:00
9f41ea7354
refactor(posts): remove orphan row_to_post_list and use row_to_post_full for get_post_by_id
2026-06-17 16:24:38 +08:00
1eedab8f21
perf(posts): remove content_md from list/search SQL, read stored word counts
2026-06-17 16:06:27 +08:00
a6f08d5d3f
feat(db): add word_count and reading_time columns to posts
2026-06-17 16:06:21 +08:00
51e20980db
perf(stats): combine three COUNT queries into one conditional aggregation
2026-06-17 15:51:29 +08:00
170c021b37
feat(cache): add PostListItem DTO and use it in list/tag/search caches
2026-06-17 15:51:19 +08:00
31d5a99d2a
Merge cleanup/redundancies: remove dead comment code and duplicate DB indexes
CI / check (push) Failing after 7m33s
CI / build (push) Has been skipped
2026-06-17 15:24:47 +08:00
70e61ab65d
docs: explain why ConnectInfo is optional for image routes
2026-06-17 15:16:26 +08:00
018b3876b7
fix: return 404 for bare /uploads path and correct CHANGELOG
2026-06-17 14:47:22 +08:00
abdfd2e3f9
fix: make If-None-Match comparison RFC 7232 compliant
2026-06-17 14:14:37 +08:00
27ce878771
feat: support If-None-Match 304 for image responses
2026-06-17 14:08:45 +08:00
21b665f41d
feat: add Cache-Control and ETag headers for image responses
2026-06-17 13:59:17 +08:00
fe6e5bd045
perf: offload image decode/resize/encode to spawn_blocking
2026-06-17 13:52:05 +08:00
b48590ced3
feat: add compression and timeout middleware, skip uploads and image routes
2026-06-17 13:45:55 +08:00