forked from alibaba/loongcollector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: check pipeline queue before scrape, try again after 1 second …
…if is not valid to push (alibaba#1757)
- Loading branch information
1 parent
6526c34
commit 6d9d5f2
Showing
13 changed files
with
119 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,38 @@ | ||
#include "prometheus/async/PromFuture.h" | ||
|
||
#include "common/Lock.h" | ||
#include "common/http/HttpResponse.h" | ||
|
||
namespace logtail { | ||
|
||
void PromFuture::Process(const HttpResponse& response, uint64_t timestampMilliSec) { | ||
template <typename... Args> | ||
bool PromFuture<Args...>::Process(Args... args) { | ||
WriteLock lock(mStateRWLock); | ||
if (mState == PromFutureState::New) { | ||
for (auto& callback : mDoneCallbacks) { | ||
callback(response, timestampMilliSec); | ||
if (!callback(std::forward<Args>(args)...)) { | ||
mState = PromFutureState::Done; | ||
return false; | ||
} | ||
} | ||
mState = PromFutureState::Done; | ||
} else { | ||
return; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void PromFuture::AddDoneCallback(std::function<void(const HttpResponse&, uint64_t timestampMilliSec)>&& callback) { | ||
template <typename... Args> | ||
void PromFuture<Args...>::AddDoneCallback(CallbackSignature&& callback) { | ||
mDoneCallbacks.emplace_back(std::move(callback)); | ||
} | ||
|
||
void PromFuture::Cancel() { | ||
template <typename... Args> | ||
void PromFuture<Args...>::Cancel() { | ||
WriteLock lock(mStateRWLock); | ||
mState = PromFutureState::Done; | ||
} | ||
|
||
template class PromFuture<const HttpResponse&, uint64_t>; | ||
template class PromFuture<>; | ||
|
||
} // namespace logtail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.