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
EZP-29253: Make session refresh re-try on timeouts and server errors #90
Conversation
007178f
to
a4eda34
Compare
In order to try to improve stability of rest client, re-try session refresh which is often the one helding others back on timout and 5xx errors.
a4eda34
to
639bebc
Compare
I tested the solution. It correctly retries the session refresh requests. However, after three requests (if all of them fail), the end result is the same - the Editor will see the login form. The reporter mentioned (and I also think that it would be a good idea) that Users should not be presented with the login form while they are logged in and still have a valid session - even if the session refresh requests are failing. Perhaps a better idea would be not to retry the requests, but let them fail silently (ofc without refreshing the session)? |
Do we have anyway of knowing that? Or you suggest we just assume it.
We could do that after 3 attempts, only thing I see as a problem is that if this endpoint is down, all other endpoints are probably down, and typically calls to other endpoints are just waiting for session refresh to complete before they are sent by client to server. Unless of course we manage to get more details from customer on cases where this fails which is not related to deployment / server being restarted and such which is what I'm trying to cover with timeout and 5xx error handling. If we get something we can reproduce on that, I would be much more comfortable changing the logic here. |
I was suggesting just assuming that the Editor still has a valid session. This is checked anyway on every request if I understand this correctly, so that shouldn't be an issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. I'm missing only the configuration for the number of retries and timeout between then (maybe as the third parameter).
This comment has been minimized.
This comment has been minimized.
src/services/UserService.js
Outdated
// We re-try session refresh for 180 seconds on timeouts/server errors as it is often the requests holding | ||
// others back(see ConnectionManager), and is thus the one request we typically need to re-try a few | ||
// times if backend has temporary downtime or is undergoing brief maintenance. | ||
if (date - (new Date()) >= (timeout || 180000)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be (new Date()) - date
(other way around).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed 😅
85e8507
to
3ed8346
Compare
Updated again, cleaned up for review. |
Merging to make aware on beta tag. |
In order to try to improve stability of rest client, re-try session refresh which is often the one holding others back on timeout and 5xx errors. Do this for up to 180 seconds which can happen on slow deployment / security updates of backend, on cases where service needs to be taken down and cache needs to be re-generated.
NOTE: This does not solve issues when backend is down and client sends other requests to it, for instance when session has just been refreshed. However 1. depending on the call that will have to be identified on a case by case basis, can't handle it generically afaik. 2. v2 solves this.
Todo:
90180 sec downtime / update / deployment window.