perf(serve): SSE live pump reads incrementally #137
Reference in New Issue
Block a user
Delete Branch "fix/130-sse-incremental"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
SSE live pump now reads only new bytes instead of the entire JSONL file.
Why
Issue #130 — long-running threads produce large JSONL files. Reading the whole file on every fs watch event is wasteful.
Changes
readFile+ slice withBun.file().slice(offset, size)viareadNewBytes()helper. Handles truncation, early returns when no new data.Ref
Closes #130. 262 tests pass.
PR #137: SSE 增量读取 ✅
readFile全文读 →Bun.file().slice(offset, size)增量读。statSync检测 truncation 正确处理。parseNewLines简化为纯 chunk 拼接。性能优化到位。LGTM。