Skip to content

fix: retry writePageViews with fewer records on quota failure - #125

Closed
alexs-mparticle wants to merge 3 commits into
developmentfrom
fix/page-view-quota-eviction
Closed

fix: retry writePageViews with fewer records on quota failure#125
alexs-mparticle wants to merge 3 commits into
developmentfrom
fix/page-view-quota-eviction

Conversation

@alexs-mparticle

Copy link
Copy Markdown
Collaborator

Summary

  • When writePageViews fails due to localStorage quota, evict the oldest record and retry — continuing until the write succeeds or no records remain
  • Uses let + immutable slice(1) instead of mutating a const array
  • Keeps the most-recent page views under quota pressure rather than discarding the entire write

Why

~385 quota PAGE_VIEW_CAPTURE_FAILED errors/day in Datadog. The browser's total origin localStorage is full, so the write fails even with the 25-record cap in place. Evicting progressively fewer records may succeed when there is some space available, just not enough for all 25.

Test plan

  • Existing: persists views and caps at 25 most-recent
  • New: single eviction — fails once, succeeds with 4 records (oldest dropped)
  • New: multi-eviction — fails 3 times, succeeds with 2 records
  • New: pre-seeded storage — 5 existing + 1 new, write of 6 fails, retries with 5 succeed (oldest of 6 dropped)
  • New: total failure — all writes fail, returns false
  • Lint and build pass

🤖 Generated with Claude Code

@alexs-mparticle
alexs-mparticle changed the base branch from main to development August 19, 2026 19:38
When localStorage is full, evict the oldest page-view records one by one
and retry until the write succeeds or no records remain. Preserves the
most-recent data under quota pressure instead of discarding the entire write.
@alexs-mparticle
alexs-mparticle force-pushed the fix/page-view-quota-eviction branch from 0032ff2 to 3ca27d7 Compare August 19, 2026 19:41
@alexs-mparticle

Copy link
Copy Markdown
Collaborator Author

closed in favor of #126

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.

1 participant