From f637af86c6f248bb3b5ee49c9ed460ea3fd7e38d Mon Sep 17 00:00:00 2001 From: henryzhx8 Date: Mon, 23 Dec 2024 05:40:26 +0000 Subject: [PATCH] polish --- core/plugin/flusher/sls/FlusherSLS.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/core/plugin/flusher/sls/FlusherSLS.cpp b/core/plugin/flusher/sls/FlusherSLS.cpp index efe51d7f89..d8bdccad71 100644 --- a/core/plugin/flusher/sls/FlusherSLS.cpp +++ b/core/plugin/flusher/sls/FlusherSLS.cpp @@ -835,16 +835,6 @@ void FlusherSLS::OnSendDone(const HttpResponse& response, SenderQueueItem* item) if (isProfileData && data->mTryCnt >= static_cast(INT32_FLAG(profile_data_send_retrytimes))) { operation = OperationOnFail::DISCARD; } -#ifdef __ENTERPRISE__ - bool hasNetworkError = (sendResult == SEND_NETWORK_ERROR || sendResult == SEND_SERVER_ERROR); - EnterpriseSLSClientManager::GetInstance()->UpdateHostStatus(mProject, mCandidateHostsInfo->GetMode(), data->mCurrentHost, !hasNetworkError); - mCandidateHostsInfo->SelectBestHost(); - if (!hasNetworkError) { - bool hasAuthError = sendResult == SEND_UNAUTHORIZED; - EnterpriseSLSClientManager::GetInstance()->UpdateAccessKeyStatus(mAliuid, !hasAuthError); - EnterpriseSLSClientManager::GetInstance()->UpdateProjectAnonymousWriteStatus(mProject, !hasAuthError); - } -#endif #define LOG_PATTERN \ ("failed to send request", failDetail.str())("operation", GetOperationString(operation))("suggestion", \ @@ -892,6 +882,18 @@ void FlusherSLS::OnSendDone(const HttpResponse& response, SenderQueueItem* item) break; } } +#ifdef __ENTERPRISE__ + bool hasNetworkError = (sendResult == SEND_NETWORK_ERROR || sendResult == SEND_SERVER_ERROR); + EnterpriseSLSClientManager::GetInstance()->UpdateHostStatus( + mProject, mCandidateHostsInfo->GetMode(), data->mCurrentHost, !hasNetworkError); + mCandidateHostsInfo->SelectBestHost(); + + if (!hasNetworkError) { + bool hasAuthError = sendResult == SEND_UNAUTHORIZED; + EnterpriseSLSClientManager::GetInstance()->UpdateAccessKeyStatus(mAliuid, !hasAuthError); + EnterpriseSLSClientManager::GetInstance()->UpdateProjectAnonymousWriteStatus(mProject, !hasAuthError); + } +#endif } bool FlusherSLS::Send(string&& data, const string& shardHashKey, const string& logstore) {