CAPI: return good data from worker & start handling reauth

This commit is contained in:
Athanasius committed 2021-08-23 18:29:32 +01:00
1 parent ce02cfdf2d
commit 018b4563b3
2 files changed
+15 -6

No files matched your search

+7
View File
@@ -1075,6 +1075,13 @@ class AppWindow(object):
# TODO: Set status text
return
except companion.CredentialsError:
# Redirected back to Auth server - force full re-authentication
companion.session.dump(r)
companion.session.invalidate()
companion.session.retrying = False
companion.session.login()
# Companion API problem
except companion.ServerLagging as e:
err = str(e)
+8 -6
View File
@@ -642,12 +642,10 @@ class Session(object):
if r.url.startswith(SERVER_AUTH):
logger.info('Redirected back to Auth Server')
# Redirected back to Auth server - force full re-authentication
self.dump(r)
self.invalidate()
self.retrying = False
self.login()
raise CredentialsError()
self.capi_response_queue.put(
CAPIFailedRequest(f'Redirected back to Auth Server', exception=CredentialsError()
)
continue
elif 500 <= r.status_code < 600:
# Server error. Typically 500 "Internal Server Error" if server is down
@@ -656,6 +654,10 @@ class Session(object):
# LANG: Frontier CAPI data retrieval failed with 5XX code
raise ServerError(f'{_("Frontier CAPI server error")}: {r.status_code}')
self.capi_response_queue.put(
data
)
logger.info('CAPI worker thread DONE')
def capi_query_close_worker(self) -> None: