Private
Public Access
1
0

core: HTTPClient: update socket should just automatically retry on subsqeuent auth success

This commit is contained in:
2025-09-09 13:33:13 -07:00
parent 4db28222a6
commit 357be5cdf4

View File

@@ -426,6 +426,7 @@ impl<K: AuthenticationStore + Send + Sync> APIInterface for HTTPAPIClient<K> {
log::debug!("Websocket request: {:?}", request);
let mut should_retry = true; // retry once after authenticating.
match connect_async(request).await.map_err(Error::from) {
Ok((socket, response)) => {
log::debug!("Websocket connected: {:?}", response.status());
@@ -440,8 +441,12 @@ impl<K: AuthenticationStore + Send + Sync> APIInterface for HTTPAPIClient<K> {
let new_token = self.authenticate(credentials.clone()).await?;
self.auth_store.set_token(new_token.to_string()).await;
if should_retry {
// try again on the next attempt.
continue;
} else {
break Err(e);
}
} else {
log::error!("Websocket unauthorized, no credentials provided");
break Err(Error::ClientError(