mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-18 17:05:48 +00:00
* fix(persistence): increase IndexedDB retry window for session-restart locks On Linux desktop environments (especially Flatpak with autostart), logging out and back in can leave stale LevelDB locks for 5-15+ seconds. The previous retry window (~3.5s) was too short to outlast this, causing "Database Error - Cannot Load Data" on every logout/login cycle. Increase IDB_OPEN_RETRIES from 3 to 5 and IDB_OPEN_RETRY_BASE_DELAY_MS from 500ms to 1000ms, giving a total retry window of ~31 seconds. Fixes #7191 * fix: update stale retry timing comments to match new constants * fix(persistence): gate long IDB retry window on lock-related errors _ensureInit() is awaited by every op-log read/write, and the hydrator auto-reloads on IndexedDB open errors. Applying the ~31s retry window to every error class could create a reload -> wait -> reload loop that feels like a hang. Classify the error on first failure and fall back to a short retry budget (IDB_OPEN_RETRIES_NON_LOCK=2, ~3s window) for errors that don't look lock-related. InvalidStateError and messages containing "backing store" still get the full window used for stale LevelDB locks on Linux desktop session restart. See #7191. The spec is hardened to assert concrete constant floors rather than recomputing the backoff formula (which only proved the formula matched itself). Also adds unit tests for the classification helper. * fix(persistence): address review feedback on IDB retry split - Correct stale "auto-reload" rationale in op-log-errors.const, operation-log.const, operation-log-store.service, and archive-store.service: the hydrator shows a blocking alert dialog on IndexedDBOpenError, it does not auto-reload. The fail-fast argument now reflects the real reason — every op-log read/write awaits _ensureInit(), so a 31s wait on a non-lock error blocks the subsystem for 31s before the alert dialog surfaces. - isLockRelatedIdbOpenError now checks `err instanceof DOMException || err instanceof Error` before reading .name/.message, mirroring the pattern in the sibling isConnectionClosingError. In some Electron / older runtimes DOMException does not satisfy instanceof Error. - Added behavioral tests for _openDbWithRetry that spy on a new _openDbOnce testing seam: generic errors take exactly 1 + IDB_OPEN_RETRIES_NON_LOCK attempts, InvalidStateError takes up to 1 + IDB_OPEN_RETRIES, and a lock-error followed by success resolves. - Bumped IDB_OPEN_RETRIES_NON_LOCK from 2 to 3 to match master's pre-PR retry count (1s + 2s + 4s = ~7s ceiling). Framing this as "keep master's existing retry count for non-lock errors, add long retry only for lock errors" is a lower-risk scope. Adjusted the const spec's upper-bound assertion accordingly. - Replaced the "retries 1-5" hardcoded schedule comment in operation-log-store.service and archive-store.service with a formula-based comment so the two retry budgets can't drift out of sync with reality. - Added two DOMException-shaped test cases to operation-log.const.spec.ts covering the new predicate branch. * docs(persistence): clean up rot-prone worked examples in retry docstrings |
||
|---|---|---|
| .. | ||
| app | ||
| assets | ||
| environments | ||
| static | ||
| styles | ||
| test-helpers | ||
| typings | ||
| _common.scss | ||
| favicon.ico | ||
| hammer-config.class.ts | ||
| index.html | ||
| karma.conf.js | ||
| main.ts | ||
| manifest.json | ||
| polyfills.ts | ||
| styles.scss | ||
| test.ts | ||
| tsconfig.app.json | ||
| tsconfig.spec.json | ||
| tsconfig.worker.json | ||