Don't restart refresh token while it's already processing

If two requests to the API occur at the same time, they will both see at the same time that they need an access token, and if it is expired they will both see that it needs refreshing. The server then sees two refreshes, both with the same refresh token. This is not allowed. The second one then gets a failure to refresh the token, which causes the user to log out.
Instead, we'll stop one of the refresh requests. They were fire-and-forget anyway, so it's not needed to actually continue the request.

Contributes to issue CURA-8539.
This commit is contained in:
Ghostkeeper 2021-11-22 18:52:43 +01:00
parent 608cce491d
commit 3f92b46ac8
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
2 changed files with 7 additions and 1 deletions

View file

@ -66,7 +66,7 @@ class CloudPackageChecker(QObject):
self._application.getHttpRequestManager().get(url,
callback = self._onUserPackagesRequestFinished,
error_callback = self._onUserPackagesRequestFinished,
timeout=10,
timeout = 10,
scope = self._scope)
def _onUserPackagesRequestFinished(self, reply: "QNetworkReply", error: Optional["QNetworkReply.NetworkError"] = None) -> None: