ytptube/app/library
Jesse Bate 0cb3a95a41 perf: batch item_updated WebSocket events into a single per-tick payload
The per-download 500ms throttle still scales linearly with concurrency:
N active downloads produce up to 2N item_updated frames per second, each
with its own serialization pass and per-client send.

Add an ItemBatcher at the WebSocket boundary that coalesces dirty items
by _id (last write wins) and emits one item_updated frame per 500ms
tick whose payload is always a list of items, even for a single update.
Leading-edge emits keep isolated updates (e.g. renames via the API)
instant, and a trailing flush at most 500ms later delivers the rest.
Pending items are flushed on shutdown before clients disconnect.

Emitter call sites, the EventBus, and the StatusTracker throttle are
unchanged; the batcher only changes the wire format. The frontend now
types item_updated as StoreItem[] and iterates the array.

BREAKING CHANGE: the item_updated WebSocket event payload (data) is now
always an array of items instead of a single item object.
2026-06-10 23:38:27 +09:30
..
downloads feat: add YTP_MAX_HISTORY to cap history and prevent unbounded DB growth 2026-06-10 20:29:18 +09:30
ag_utils.py Import ag_utils 2025-04-26 17:56:01 +03:00
BackgroundWorker.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
cache.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
cf_solver_handler.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
cf_solver_shared.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
config.py feat: add YTP_MAX_HISTORY to cap history and prevent unbounded DB growth 2026-06-10 20:29:18 +09:30
DataStore.py feat: add YTP_MAX_HISTORY to cap history and prevent unbounded DB growth 2026-06-10 20:29:18 +09:30
diagnostics.py feat: add system diagnostics endpoint. 2026-05-26 19:22:36 +03:00
encoder.py perf: exclude unused fields from ItemDTO list and WebSocket serialization 2026-06-10 20:09:13 +09:30
Events.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
HttpAPI.py feat: make log level runtime managable. 2026-05-28 21:26:23 +03:00
HttpSocket.py perf: batch item_updated WebSocket events into a single per-tick payload 2026-06-10 23:38:27 +09:30
httpx_client.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
ItemBatcher.py perf: batch item_updated WebSocket events into a single per-tick payload 2026-06-10 23:38:27 +09:30
ItemDTO.py perf: exclude unused fields from ItemDTO list and WebSocket serialization 2026-06-10 20:09:13 +09:30
log.py feat: make log level runtime managable. 2026-05-28 21:26:23 +03:00
log_control.py feat: make log level runtime managable. 2026-05-28 21:26:23 +03:00
migrate.py chore: packages update and some formatting 2026-02-05 01:28:06 +03:00
operations.py Refactor: improve linting and formatting 2025-12-30 20:42:50 +03:00
PackageInstaller.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
router.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
Scheduler.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
Services.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
Singleton.py fixes 2025-09-12 19:34:12 +03:00
sqlite_store.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
TerminalSessionManager.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
UpdateChecker.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
Utils.py refactor: use single logger namespace 2026-05-28 19:07:11 +03:00
version.py Migrate configStore to ts 2025-06-22 21:49:07 +03:00