Skip to content

WebGL offline persistence#270

Merged
melekr merged 1 commit intomasterfrom
webgl/offline_persistence
Jan 30, 2026
Merged

WebGL offline persistence#270
melekr merged 1 commit intomasterfrom
webgl/offline_persistence

Conversation

@melekr
Copy link
Copy Markdown
Collaborator

@melekr melekr commented Jan 21, 2026

Context

WebGL users can lose unsent reports when Backtrace is initialized while offline.

Changes

  • Fix missing offline reports when the SDK is initialized while offline.
    BacktraceClient.Initialize(url) now enables offline persistence by default on WebGL runtime builds.
  • Move offline replay and filesystem flush logic from BacktraceClient into BacktraceDatabase to match SDK architecture and separation of concerns.
  • Add write-ahead persistence to the PlayerPrefs backed fallback queue before sending to prevent data loss when the send callback never executes due to browser lifecycle teardown.
  • Handle rate-limiting: Do not delete on-disk database records when LimitReached and do not count toward retry attempts (applies to both on-disk DB and fallback queue).
  • Add debounced FS.syncfs calls on database write/delete and lifecycle hooks via .jslib.

Sample Reports

ref: BT-6427

Enable offline persistence by default for Initialize(url) on WebGL.
Move offline replay and syncfs to BacktraceDatabase.
Write ahead persist to PlayerPrefs queue and handle rate-limiting correctly.
@melekr melekr requested a review from rick-bt January 21, 2026 23:25
@melekr melekr self-assigned this Jan 21, 2026
@melekr melekr requested a review from konraddysput January 22, 2026 18:21
@rick-bt rick-bt requested review from gm4sl and removed request for konraddysput January 30, 2026 17:34
Copy link
Copy Markdown
Contributor

@rick-bt rick-bt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code walkthrough. Approved.

@melekr melekr merged commit fb06b05 into master Jan 30, 2026
8 checks passed
@melekr melekr mentioned this pull request Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants