-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On-demand flushing of offline transport #14746
Comments
I feel like we should just make it so that the @timfish does that feel reasonable? If so let's do this for v9 (we are working on the next major and this feels like an appropriate change for that). |
Makes sense, although what would this mean for existing usages of flush, like in the Electron SDK where it's called before exit? Would we want to attempt to flush the offline queue before exit too? Most usages of flush will use a timeout but that would limit how much can actually be sent.
Maybe we should be adding this feature back to the latest offline transport? Ah, just read this part:
How did your offline detection work? Care to share the code? |
Sure. We had some of the same problems you mentioned in #6403:
For our app in particular, it's designed to connect to non-Internet-connected IoT devices; since it has a network connection, So we made a simple interface: export interface OfflineStatus {
addOnlineEventListener(eventHandler: () => void): void;
isOnline(): boolean | null;
} We modified the Offline integration so that it defaulted to a After looking at the new offline transport, I had just about decided that our approach was overly complex (or, at least, that it's too complex to justify for Sentry itself) and that Sentry's new approach of automatic retry on any error would work well, if augmented with Sentry exposing a Thinking about this more today, adding basic |
Yes, however unreliable |
@joshkel I tried to add you as a reviewer to the PR but it wouldn't let me so let me know what you think! |
@timfish Looks great. Thanks! |
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 aflushNow
method that immediately starts processing the queue.If this approach seems reasonable, I can open a PR.
Footnotes
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. ↩
The text was updated successfully, but these errors were encountered: