Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
henryzhx8 committed Dec 13, 2024
1 parent 3ca2ae7 commit 598b506
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions core/plugin/flusher/sls/DiskBufferWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand All @@ -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(
Expand Down
3 changes: 1 addition & 2 deletions core/plugin/flusher/sls/FlusherSLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 598b506

Please sign in to comment.