Skip to content

Skip push requests when the browser is offline#677

Merged
ssh000 merged 1 commit into
mainfrom
fix/skip-requests-when-browser-is-offline
Apr 28, 2026
Merged

Skip push requests when the browser is offline#677
ssh000 merged 1 commit into
mainfrom
fix/skip-requests-when-browser-is-offline

Conversation

@ssh000
Copy link
Copy Markdown
Contributor

@ssh000 ssh000 commented Apr 24, 2026

Prevent sending a request when a browser is offline

Fixes: appsignal/support#338

@backlog-helper
Copy link
Copy Markdown

backlog-helper Bot commented Apr 24, 2026

✔️ All good!

New issue guide | Backlog management | Rules | Feedback

@ssh000 ssh000 force-pushed the fix/skip-requests-when-browser-is-offline branch from d7fd833 to 9119f63 Compare April 24, 2026 14:37
@ssh000 ssh000 added the enhancement An improvement to an existing feature. label Apr 24, 2026
Reject pushes in `PushApi#push` when `navigator.onLine === false` so no
fetches are made without connectivity. Existing catch paths queue the
span and let the dispatcher keep retrying.

Fixes: appsignal/support#338
@ssh000 ssh000 force-pushed the fix/skip-requests-when-browser-is-offline branch from 9119f63 to 3b82c3c Compare April 24, 2026 14:40
@ssh000 ssh000 requested a review from unflxw April 24, 2026 14:54
Copy link
Copy Markdown
Contributor

@unflxw unflxw left a comment

Choose a reason for hiding this comment

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

We should take a look at the "queue" mechanism for the integration, which should attempt to retry sending these at a later point. I recall taking a look at it at some point and suspecting it to not actually work, which would mean whatever was being pushed is lost forever, not retried at a later time.

That said, that's a pre-existing issue, and as such this PR is an improvement over status quo.

*/
public async push(span: Span): Promise<Span> {
if (isOffline()) {
return Promise.reject()
Copy link
Copy Markdown
Contributor

@unflxw unflxw Apr 27, 2026

Choose a reason for hiding this comment

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

Does something catch this rejection? An unhandled promise rejection would trigger a plugin-window-events loop in the same way that uncaught exceptions do, as described in https://github.com/appsignal/support/issues/338#issuecomment-2488668536

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is a catch that swallows the error, I also tested it

@backlog-helper
Copy link
Copy Markdown


This is a message from the daily scheduled checks.

New issue guide | Backlog management | Rules | Feedback

@ssh000
Copy link
Copy Markdown
Contributor Author

ssh000 commented Apr 28, 2026

We should take a look at the "queue" mechanism for the integration, which should attempt to retry sending these at a later point. I recall taking a look at it at some point and suspecting it to not actually work, which would mean whatever was being pushed is lost forever, not retried at a later time.

That said, that's a pre-existing issue, and as such this PR is an improvement over status quo.

Yes I noticed that queue is drained even if it cannot send errors and I also noticed that backoff factor makes next retries too far away in time so when you recovered from an error or becoming online you will not send queue in the near feature. I didn't want to mix it all together, but if you want me I can do this here?

@ssh000 ssh000 merged commit 053dc59 into main Apr 28, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An improvement to an existing feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants