mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-12-05 19:25:00 +03:00
Add SqliteDocStorage::has_active_blob to check blob existence without reading blob payload overflow pages during ingestion. Remove the redundant pre-check loop for generated media block IDs and retry only when PageDocSession::insert_block reports a duplicate key. Store SpaceSyncEngine outbound items in a VecDeque, peek before send in WorkspaceSession, disconnect immediately on send failure, and clear stale frames on disconnect. Drop passive remote broadcasts for unknown documents without local baselines or active loads in an in-memory session, bound in-flight load staging with a reload flag, and clear load leases on failure, disconnect, or deletion. Another writer of the same SQLite file can add a document after a session opens. Thus a SQLite-backed session stages passive broadcasts for unknown documents, up to 64 documents and 1 MiB. The next flush persists the broadcasts for documents that SQLite has and drops the others. Above the limits, the oldest document loses its staged broadcasts and needs a reload. Split share receipt persistence into a sibling module and reject shares targeting tombstoned documents before any write. Keep only the written sidecar keys and their previous entries for rollback. When COMMIT fails, take a new write lock and read the sidecar again. Restore only the keys that still hold this attempt without a committed import. Thus receipts that another writer committed after SQLite released the lock stay. Migrate a legacy receipt of a permanently deleted document without a witness, so the migration does not recreate its doc properties row, and count that receipt as committed while the document stays deleted. Reclaim oldest complete quarantine groups in ShareDiskInbox when old quarantine files block valid batches under the 128 MiB cap.