From 886376e8bd95ef633aa4b3d7a8377f1003764748 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 4 Sep 2024 22:01:31 +0800 Subject: [PATCH] chore: update client api log --- libs/client-api/src/native/http_native.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/client-api/src/native/http_native.rs b/libs/client-api/src/native/http_native.rs index 8ab165b0..25ef1f6b 100644 --- a/libs/client-api/src/native/http_native.rs +++ b/libs/client-api/src/native/http_native.rs @@ -30,7 +30,7 @@ use std::task::{Context, Poll}; use std::time::Duration; use tokio_retry::strategy::{ExponentialBackoff, FixedInterval}; use tokio_retry::{Condition, RetryIf}; -use tracing::{event, info, instrument, trace}; +use tracing::{debug, event, info, instrument, trace}; pub use infra::file_util::ChunkedBytes; use shared_entity::dto::ai_dto::CompleteTextParams; @@ -243,13 +243,18 @@ impl Client { let _ = tx.send(result.clone()); } self.is_refreshing_token.store(false, Ordering::SeqCst); + } else { + debug!("refresh token is already in progress"); } // Wait for the result of the refresh token request. match tokio::time::timeout(Duration::from_secs(60), rx).await { Ok(Ok(result)) => result, Ok(Err(err)) => Err(AppError::Internal(anyhow!("refresh token error: {}", err)).into()), - Err(_) => Err(AppError::RequestTimeout("refresh token timeout".to_string()).into()), + Err(_) => { + self.is_refreshing_token.store(false, Ordering::SeqCst); + Err(AppError::RequestTimeout("refresh token timeout".to_string()).into()) + }, } }