Skip to content

Comments

Add retry on network error#15

Open
iharthi wants to merge 4 commits intomasterfrom
web-eid-2024-12-retry-on-network-error
Open

Add retry on network error#15
iharthi wants to merge 4 commits intomasterfrom
web-eid-2024-12-retry-on-network-error

Conversation

@iharthi
Copy link

@iharthi iharthi commented Apr 3, 2025

In some cases when running on a mobile device, the browser going into background and back may result in network error when polling signing status.

This MR (done on top of !14) adds a retry logic that tries to re-do the query on network error before giving up. BE changes are needed to take full advantage of this (see thorgate/django-esteid#72)

@iharthi iharthi force-pushed the web-eid-2024-12-retry-on-network-error branch from 933536c to fe14bfb Compare April 4, 2025 10:17
@Jyrno42 Jyrno42 force-pushed the web-eid-2024-12-retry-on-network-error branch from fe14bfb to 33375df Compare April 10, 2025 14:56

try {
const response = await fetch(url, { method, headers, body });
if (`${response.status}` !== "410") {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick but maybe doing it the other way around and using an early return for 410 would be easier to read.

@iharthi iharthi force-pushed the web-eid-2024-12-retry-on-network-error branch from 33375df to b6aed7a Compare April 11, 2025 10:35
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.

2 participants