Fix R8: compact JSON for the large media-items store
writeJsonAtomic always pretty-printed (JSON.stringify(value, null, 2)), which needlessly inflates size and write time for the media-items store (up to MAX_ITEMS=20000 rows). Added an optional `pretty` flag (default true, so history/sources/templates/errorlog stay hand-inspectable) threaded through createJsonStore, and set it false for media-items.json. typecheck + 242 tests + eslint green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -27,7 +27,9 @@ const MAX_ITEMS = 20000
|
||||
// rewrite the whole (≤MAX_ITEMS) file on every completion; now reads hit the
|
||||
// cache and writes are batched. Sources are few, so that store is uncapped.
|
||||
const sourcesStore = createJsonStore('sources.json', isValidSource, Infinity)
|
||||
const itemsStore = createJsonStore('media-items.json', isValidMediaItem, MAX_ITEMS)
|
||||
// Compact (not pretty) -- this store can hold up to MAX_ITEMS rows; indentation
|
||||
// would needlessly inflate its size and write time (R8).
|
||||
const itemsStore = createJsonStore('media-items.json', isValidMediaItem, MAX_ITEMS, false)
|
||||
|
||||
// --- Sources ----------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user