Files
AFFiNE/packages
DarkSky a83ea1e1a3 fix(preview): bound PDF wait eviction, native open tracking, and session cleanup
Retain failed PDF tombstones in `refresh_pdf_previews` only while a card or the viewer shows that source. This stops retry loops while shown and drops byte references once removed.

Track each active native PDF open by monotonic `open_id` and payload bytes in `DocTable`. Each `(scope_id, source_id)` targets at most one payload at a time. Switching to different bytes clears stale results and waits before cache lookups, cancelling unstarted opens with no remaining waiters. Two live scopes with colliding keys never evict each other. Notify `cv_idle` whenever job pruning or scope cleanup leaves the queue idle.

Harden `WasmPdfState` without changing its interface or keeping PDF byte buffers. Skip `counts` writes for out-of-range sizes. Clear `in_flight` on session close or open cancel. Close idle zero-page and first-open failures while keeping known counts on reopen failure. Verify `doc_id` ownership in `answer` and `admit`.

Track queued `waiters` per entry in `pdf-client.js` so concurrent opens over 64 documents never evict waiting entries. Trim idle known entries back to 64 as requests close or settle. Wake and reject waiters at once when bytes change or the client disposes. Keep transient worker fetch errors retryable with no negative error cache.
2026-12-01 23:46:24 +09:00
..