Skip to content
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

fix(HMS-2261): show warning when polling reservation fails #294

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

amirfefer
Copy link
Member

When the reservation polling fails after a few attempts, (status != 200), the reservation was created already successfully, but there is no way to fetch the current launch status, this PR adds a warning , something like:

Screen Shot 2023-08-03 at 17 07 34

@mshriver
Copy link
Member

mshriver commented Aug 4, 2023

/retest

@lzap
Copy link
Member

lzap commented Aug 7, 2023

LGTM

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

Will this happen on first failure? If this would be on first failure, I would consider this confusing.

Also while trying to verify the above Q, I've hit https://tkdodo.eu/blog/breaking-react-querys-api-on-purpose which says the callbacks are not great way to do things and are deprecated in React Query v4. I guess you will make more sense out of whether we care or not, but they seem to think that using it for state management is a bad idea 🤷 :)

@ezr-ondrej
Copy link
Member

Also the commit message is missing the delimeter ( : ) between fix and the actual subject and thus the commit message check is failing here :)

@amirfefer
Copy link
Member Author

amirfefer commented Aug 7, 2023

@ezr-ondrej,
We opened this issue because we break the API on purpose in the last tech discussion :) by hardcoding a different reservation id during polling, and getting a 404 error. this caused the UI progress to freeze.

Will this happen on first failure?

I'm not sure if I understand, could you explain?

Thanks for this blog post, we definitely need to start migrating our react-query 👍

Another solution here is using the timeout warning (but it is a bit odd to spam our backend with 404 / 500 until a timeout is reached)

@lzap
Copy link
Member

lzap commented Aug 8, 2023

Yeah you don’t have the context: @avitova figured out that if backend returns 404 (e.g. reservation is deleted somehow) the UI gets stuck because it tries to fetch /reservations/ID over and over again. It never stops. It is a valid bug, we should be checking HTTP codes thus this PR.

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

Oh, I guess I understand now :)

The thing I'm worried about is if this sets an error on first failure (that react-query usually recovers from if that's just network issue, won't this completely stop the process, because now we set warning and thus stop polling?

@ezr-ondrej
Copy link
Member

Another solution here is using the timeout warning (but it is a bit odd to spam our backend with 404 / 500 until a timeout is reached)

I agree this is kinda ok solution for now, until we will need to migrate to newer react-query, but I'm just worried we break other cases here. Not every error should stop the polling immediatly, right?

@lzap
Copy link
Member

lzap commented Aug 10, 2023

Not every error should stop the polling immediatly, right?

Examples?

@amirfefer
Copy link
Member Author

amirfefer commented Aug 10, 2023

@ezr-ondrej this change does not break the polling at the first attempt, there are 3 attempts by default, and only than the error raise.

We can increase the retries as we wish

https://tanstack.com/query/v4/docs/react/guides/query-retries

@amirfefer amirfefer changed the title fix(HMS-2261) show warning when polling reservation fails fix(HMS-2261): show warning when polling reservation fails Aug 15, 2023
@amirfefer
Copy link
Member Author

updated commit message.

@ezr-ondrej
Copy link
Member

/retest

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

In that case, perfect! thank you! 🙏

@ezr-ondrej ezr-ondrej merged commit 681bf28 into RHEnVision:main Aug 22, 2023
3 checks passed
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.

4 participants