Skip to content

On-demand flushing of offline transport #14746

Closed
@joshkel

Description

@joshkel

Problem Statement

Our web application is designed to be used offline and only periodically connected to the Internet to sync data. We used Sentry's old, deprecated Offline integration 1 to handle Sentry events; it knew when the app was connected to the Internet, so it could sync on demand.

The new offline transport looks nice, but it apparently doesn't offer a way to flush on demand. I'm concerned that our users may not leave their apps connected to the Internet long enough for the (potentially) one hour retry delay to fire.

Solution Brainstorm

The { send; flush } object that makeOfflineTransport returns could add a flushNow method that immediately starts processing the queue.

    function flushNow(): void {
      flushIn(MIN_DELAY);
      retryDelay = START_DELAY;
    }

If this approach seems reasonable, I can open a PR.

Footnotes

  1. Technically, we used a fork of the Offline integration, where we implemented our own offline detection, due to limitations in the browser's standard feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: browserIssues related to the Sentry Browser SDK

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions