Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Abingcbc committed Dec 30, 2024
1 parent f178d8c commit 2564ee3
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
16 changes: 0 additions & 16 deletions core/runner/sink/http/HttpSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ HttpSink* HttpSink::GetInstance() {
}

bool HttpSink::Init() {
#ifndef APSARA_UNIT_TEST_MAIN
mClient = curl_multi_init();
if (mClient == nullptr) {
LOG_ERROR(sLogger, ("failed to init http sink", "failed to init curl multi client"));
Expand All @@ -71,13 +70,9 @@ bool HttpSink::Init() {

mThreadRes = async(launch::async, &HttpSink::Run, this);
return true;
#else
return HttpSinkMock::GetInstance()->Init();
#endif
}

void HttpSink::Stop() {
#ifndef APSARA_UNIT_TEST_MAIN
mIsFlush = true;
if (!mThreadRes.valid()) {
return;
Expand All @@ -88,9 +83,6 @@ void HttpSink::Stop() {
} else {
LOG_WARNING(sLogger, ("http sink", "forced to stopped"));
}
#else
HttpSinkMock::GetInstance()->Stop();
#endif
}

void HttpSink::Run() {
Expand Down Expand Up @@ -125,14 +117,6 @@ void HttpSink::Run() {
}
}

bool HttpSink::AddRequest(std::unique_ptr<HttpSinkRequest>&& request) {
#ifndef APSARA_UNIT_TEST_MAIN
return Sink<HttpSinkRequest>::AddRequest(std::move(request));
#else
return HttpSinkMock::GetInstance()->AddRequest(std::move(request));
#endif
}

bool HttpSink::AddRequestToClient(unique_ptr<HttpSinkRequest>&& request) {
curl_slist* headers = nullptr;
CURL* curl = CreateCurlHandler(request->mMethod,
Expand Down
3 changes: 0 additions & 3 deletions core/runner/sink/http/HttpSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ class HttpSink : public Sink<HttpSinkRequest> {
bool Init() override;
void Stop() override;

// rewrite for unittest
bool AddRequest(std::unique_ptr<HttpSinkRequest>&& request);

private:
HttpSink() = default;
~HttpSink() = default;
Expand Down
4 changes: 0 additions & 4 deletions core/unittest/pipeline/HttpSinkMock.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ class HttpSinkMock : public HttpSink {
}
}

bool AddRequest(std::unique_ptr<HttpSinkRequest>&& request) {
return Sink<HttpSinkRequest>::AddRequest(std::move(request));
}

std::vector<SenderQueueItem>& GetRequests() {
std::lock_guard<std::mutex> lock(mMutex);
return mRequests;
Expand Down

0 comments on commit 2564ee3

Please sign in to comment.