feat(settings): storage budgets and retention in settings UI, tmdbMaxSize default 5000 (INT-3)
- Automation section gets storage budget, retention and cache TTL cards bound to settings.storage - Metadata section drops deprecated cache.tmdbTtlHours / cache.emptyResultTtlSec / identity.poolArchiveDays inputs - cache.tmdbMaxSize default 256 -> 5000; migration 0051 bumps stored values still at the old default Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
0a8bfbb63e
commit
fe05138c9c
7 files changed
+119
-31
No files matched your search
@@ -29,7 +29,7 @@ const CacheShape = z.object({
|
||||
* 保留在 schema 里只为兼容已存的 JSON 与旧设置页。
|
||||
*/
|
||||
tmdbTtlHours: z.number().int().min(1).max(720),
|
||||
/** TMDB 缓存每类条数上限,超出删最旧(对照 MP CONF.tmdb,缺省 256;大内存模式 1024) */
|
||||
/** TMDB 缓存每类条数上限,超出删最旧(MP CONF.tmdb 为 256 / 大内存 1024;本项目存 PG 不占进程内存,缺省 5000) */
|
||||
tmdbMaxSize: z.number().int().min(16).max(100_000),
|
||||
/** @deprecated CACHE-2 起由 storage.cacheTtl.tmdbMissDays 取代,服务端不再读取 */
|
||||
emptyResultTtlSec: z.number().int().min(0).max(86_400),
|
||||
@@ -566,7 +566,7 @@ export const DEFAULT_SETTINGS: GlobalSettings = {
|
||||
checkIntervalSec: 60,
|
||||
cleanupTargetPercent: 80,
|
||||
tmdbTtlHours: 24,
|
||||
tmdbMaxSize: 256,
|
||||
tmdbMaxSize: 5000,
|
||||
emptyResultTtlSec: 1800,
|
||||
globalImageCache: false,
|
||||
globalImageCacheDays: 7,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import type { Kysely } from "kysely";
|
||||
import { execDdl } from "../src/migration-helpers.ts";
|
||||
|
||||
// INT-3:cache.tmdbMaxSize 缺省 256 → 5000(CACHE-2 把 TTL 拉长到天级后,256 条先被挤掉)。
|
||||
// settings 表里整段存 cache 对象,已保存过设置的库仍是旧缺省 256:只改仍等于旧缺省的值,用户改过的不动。
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: 迁移不依赖应用表类型
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await execDdl(
|
||||
db,
|
||||
`update settings set value = jsonb_set(value, '{tmdbMaxSize}', '5000'::jsonb), updated_at = now()
|
||||
where key = 'cache' and value->'tmdbMaxSize' = '256'::jsonb;`,
|
||||
);
|
||||
}
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: 同上
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await execDdl(
|
||||
db,
|
||||
`update settings set value = jsonb_set(value, '{tmdbMaxSize}', '256'::jsonb), updated_at = now()
|
||||
where key = 'cache' and value->'tmdbMaxSize' = '5000'::jsonb;`,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user