Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
henryzhx8 committed Dec 23, 2024
1 parent f390d99 commit f637af8
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions core/plugin/flusher/sls/FlusherSLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,16 +835,6 @@ void FlusherSLS::OnSendDone(const HttpResponse& response, SenderQueueItem* item)
if (isProfileData && data->mTryCnt >= static_cast<uint32_t>(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", \
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit f637af8

Please sign in to comment.