Browse Source
Make file caching fire-and-forget so IndexedDB writes do not block parsing and video loading. *Actions* Update the file pipeline code where saveFileWithMetadata(...) is called: Replace await saveFileWithMetadata(...) with a non-blocking call that stores the promise in an array, e.g. cachePromises.push(saveFileWithMetadata(...).catch(e => logWarning(e))). At the end of the pipeline kick off Promise.allSettled(cachePromises) but do not await it before parsing starts; instead log results or show a non-blocking notification on failure. Add a configurable CACHE_BLOCKING boolean flag in config. Default false; if true (special mode) allow blocking for debugging. Add logging and UI notification for cache failures without blocking the pipeline. Convert any alert() on quota errors into a non-blocking modal message or toast. Add unit tests / smoke tests: Simulate slow saveFileWithMetadata() (wrap with artificial delay) and confirm parsing and video loading start immediately without waiting for caching to finish. Simulate a QuotaExceededError and confirm the pipeline continues. *Check list* Replace await saveFileWithMetadata(...) with non-blocking logic. Pipeline starts parsing immediately even when cache save is delayed. Promise.allSettled(cachePromises) is triggered and results logged. UI shows non-blocking notification for cache failures (no alert() popups). Tests simulate slow save and quota errors and pass.refactor/sync-centralize
3 changed files with 34 additions and 3 deletions
Loading…
Reference in new issue