diff --git a/core/plugin/flusher/sls/DiskBufferWriter.cpp b/core/plugin/flusher/sls/DiskBufferWriter.cpp index 7197d6f59a..070d2b3b58 100644 --- a/core/plugin/flusher/sls/DiskBufferWriter.cpp +++ b/core/plugin/flusher/sls/DiskBufferWriter.cpp @@ -536,7 +536,6 @@ void DiskBufferWriter::SendEncryptionBuffer(const std::string& filename, int32_t string host; auto response = SendBufferFileData(bufferMeta, logData, host); auto sendRes = ConvertErrorCode(response.mErrorCode); - bool hasAuthError = false; switch (sendRes) { case SEND_OK: sendResult = true; @@ -568,7 +567,6 @@ void DiskBufferWriter::SendEncryptionBuffer(const std::string& filename, int32_t usleep(INT32_FLAG(quota_exceed_wait_interval)); break; case SEND_UNAUTHORIZED: - hasAuthError = true; usleep(INT32_FLAG(unauthorized_wait_interval)); break; default: @@ -578,6 +576,7 @@ void DiskBufferWriter::SendEncryptionBuffer(const std::string& filename, int32_t } #ifdef __ENTERPRISE__ if (sendRes != SEND_NETWORK_ERROR && sendRes != SEND_SERVER_ERROR) { + bool hasAuthError = sendRes == SEND_UNAUTHORIZED; EnterpriseSLSClientManager::GetInstance()->UpdateAccessKeyStatus(bufferMeta.aliuid(), !hasAuthError); EnterpriseSLSClientManager::GetInstance()->UpdateProjectAnonymousWriteStatus( diff --git a/core/plugin/flusher/sls/FlusherSLS.cpp b/core/plugin/flusher/sls/FlusherSLS.cpp index d08b258826..5eec77a7d2 100644 --- a/core/plugin/flusher/sls/FlusherSLS.cpp +++ b/core/plugin/flusher/sls/FlusherSLS.cpp @@ -670,7 +670,6 @@ void FlusherSLS::OnSendDone(const HttpResponse& response, SenderQueueItem* item) bool isProfileData = GetProfileSender()->IsProfileData(mRegion, mProject, data->mLogstore); int32_t curTime = time(NULL); auto curSystemTime = chrono::system_clock::now(); - bool hasAuthError = false; SendResult sendResult = SEND_OK; if (slsResponse.mStatusCode == 200) { auto& cpt = data->mExactlyOnceCheckpoint; @@ -758,7 +757,6 @@ void FlusherSLS::OnSendDone(const HttpResponse& response, SenderQueueItem* item) failDetail << "write unauthorized"; suggestion << "check access keys provided"; operation = OperationOnFail::RETRY_LATER; - hasAuthError = true; if (mUnauthErrorCnt) { mUnauthErrorCnt->Add(1); } @@ -883,6 +881,7 @@ void FlusherSLS::OnSendDone(const HttpResponse& response, SenderQueueItem* item) } #ifdef __ENTERPRISE__ if (sendResult != SEND_NETWORK_ERROR && sendResult != SEND_SERVER_ERROR) { + bool hasAuthError = sendResult == SEND_UNAUTHORIZED; EnterpriseSLSClientManager::GetInstance()->UpdateAccessKeyStatus(mAliuid, !hasAuthError); EnterpriseSLSClientManager::GetInstance()->UpdateProjectAnonymousWriteStatus(mProject, !hasAuthError); }