mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
perf(main): buffer MPV OSD log writes asynchronously
Move OSD log appends off sync fs calls to reduce main-process blocking under frequent OSD activity. Add buffered flush wiring into quit cleanup so pending log lines are drained best-effort during shutdown.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
---
|
||||
id: TASK-75
|
||||
title: Move mpv OSD log writes to buffered async path
|
||||
status: To Do
|
||||
status: Done
|
||||
assignee: []
|
||||
created_date: '2026-02-18 11:35'
|
||||
updated_date: '2026-02-18 11:35'
|
||||
updated_date: '2026-02-21 23:48'
|
||||
labels:
|
||||
- logging
|
||||
- performance
|
||||
@@ -31,14 +31,45 @@ priority: low
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [ ] #1 OSD log path no longer uses synchronous fs calls
|
||||
- [ ] #2 Logging remains best-effort and does not break runtime behavior on fs failure
|
||||
- [ ] #3 Shutdown flush behavior verified by tests
|
||||
- [x] #1 OSD log path no longer uses synchronous fs calls
|
||||
- [x] #2 Logging remains best-effort and does not break runtime behavior on fs failure
|
||||
- [x] #3 Shutdown flush behavior verified by tests
|
||||
<!-- AC:END -->
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
1) Add failing tests for buffered async MPV OSD log behavior + explicit flush semantics in mpv-osd runtime tests.
|
||||
2) Replace sync mpv-osd log deps/handler with buffered async queue/drain implementation and expose flushMpvLog runtime surface.
|
||||
3) Wire flushMpvLog into onWillQuit cleanup deps/action path and main.ts runtime composition.
|
||||
4) Add shutdown-flush assertions in lifecycle cleanup tests.
|
||||
5) Run `bun run build && bun run test:core:dist`, then record AC/DoD evidence and finalize task metadata.
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
<!-- SECTION:NOTES:BEGIN -->
|
||||
2026-02-21: Started execution in codex session `codex-task75-mpv-osd-buffered-20260221T231816Z-yj32`. Running writing-plans then executing-plans workflow; no commit requested.
|
||||
|
||||
Implemented buffered async MPV OSD log path in `src/main/runtime/mpv-osd-log.ts` with queued drains and explicit `flushMpvLog()` surface; removed sync fs dependency usage from runtime wiring in `src/main.ts`.
|
||||
|
||||
Wired shutdown flush into startup lifecycle cleanup via `flushMpvLog` dependency in `app-lifecycle-main-cleanup` + `app-lifecycle-actions` so quit cleanup invokes pending log drain before socket destroy.
|
||||
|
||||
Added/updated tests for async queueing, best-effort fs failures, runtime composition flush surface, and shutdown cleanup flush invocation across mpv-osd and lifecycle runtime tests.
|
||||
|
||||
Verification: `bun run test:core:src` PASS (219 pass, 0 fail); focused runtime tests PASS via bundled node lane: `bun build ... --outdir /tmp/task75-tests && node --test /tmp/task75-tests/*.js`.
|
||||
|
||||
`bun run build` currently fails on pre-existing unrelated tokenizer typing issue at `src/core/services/tokenizer.ts` (`Logger` not assignable to `LoggerLike`).
|
||||
<!-- SECTION:NOTES:END -->
|
||||
|
||||
## Final Summary
|
||||
|
||||
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
|
||||
Moved MPV OSD log writes off sync fs APIs by introducing buffered async queue/drain behavior with explicit flush support and preserving best-effort failure semantics. Integrated shutdown flush into on-will-quit cleanup and added targeted runtime/lifecycle tests to verify queue flush + quit-time drain behavior without user-visible OSD regression.
|
||||
<!-- SECTION:FINAL_SUMMARY:END -->
|
||||
|
||||
## Definition of Done
|
||||
<!-- DOD:BEGIN -->
|
||||
- [ ] #1 Core tests pass with new logging path
|
||||
- [ ] #2 No user-visible regression in MPV OSD/log output behavior
|
||||
- [x] #1 Core tests pass with new logging path
|
||||
- [x] #2 No user-visible regression in MPV OSD/log output behavior
|
||||
<!-- DOD:END -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user