Skip to content

Docs updates #32

Closed
Closed

Description

@fateeand

Problem

The log backend examples in README and DESIGN.md, which apps copy, can silently lose records:

  • keepalive: true on every request. Browsers refuse a keepalive request once all keepalive requests and beacons in flight exceed 64 KiB, so a burst of log records is dropped (the fetch rejects, and the example swallows it).
  • sendBeacon for every batch (DESIGN.md's batching example). sendBeacon has the same 64 KiB quota and returns false when it refuses; the example ignores the result, so the batch is lost.

Expected

  • keepalive only while the page is hidden, i.e. may be closing (document.visibilityState === 'hidden').
  • The batching example sends with a plain fetch while the page is visible, uses sendBeacon only in flush(), and falls back to fetch when the beacon is refused, documented as best effort on unload.
  • README and DESIGN.md say why, briefly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions