Skip to content

Commit d7be7c0

Browse files
committed
Cleanup
1 parent 6de20c1 commit d7be7c0

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class HttpClient : public opentelemetry::ext::http::client::HttpClient
361361
std::unordered_map<uint64_t, std::shared_ptr<Session>> pending_to_abort_sessions_;
362362
std::unordered_map<uint64_t, HttpCurlEasyResource> pending_to_remove_session_handles_;
363363
std::list<std::shared_ptr<Session>> pending_to_remove_sessions_;
364-
std::deque<Session *> pending_to_retry_sessions_;
364+
std::deque<std::shared_ptr<Session>> pending_to_retry_sessions_;
365365

366366
std::mutex background_thread_m_;
367367
std::unique_ptr<std::thread> background_thread_;

ext/src/http/client/curl/http_client_curl.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ bool HttpClient::MaybeSpawnBackgroundThread()
486486

487487
if (operation->IsRetryable())
488488
{
489-
self->pending_to_retry_sessions_.push_front(session);
489+
self->pending_to_retry_sessions_.push_front(hold_session);
490490
}
491491
}
492492
}
@@ -790,7 +790,8 @@ bool HttpClient::doRemoveSessions()
790790

791791
bool HttpClient::doRetrySessions()
792792
{
793-
auto has_data = false;
793+
const auto now = std::chrono::system_clock::now();
794+
auto has_data = false;
794795

795796
// Assumptions:
796797
// - This is a FIFO list so older sessions, pushed at the front, always end up at the tail
@@ -807,7 +808,7 @@ bool HttpClient::doRetrySessions()
807808
{
808809
retry_it = decltype(retry_it){pending_to_retry_sessions_.erase(std::next(retry_it).base())};
809810
}
810-
else if (operation->NextRetryTime() < std::chrono::system_clock::now())
811+
else if (operation->NextRetryTime() < now)
811812
{
812813
auto easy_handle = operation->GetCurlEasyHandle();
813814
curl_multi_remove_handle(multi_handle_, easy_handle);

ext/src/http/client/curl/http_operation_curl.cc

+6-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,12 @@ HttpOperation::HttpOperation(opentelemetry::ext::http::client::Method method,
289289
compression_(compression),
290290
is_log_enabled_(is_log_enabled),
291291
retry_policy_(retry_policy),
292-
retry_attempts_(0),
292+
retry_attempts_((retry_policy.max_attempts > 0U &&
293+
retry_policy.initial_backoff > SecondsDecimal::zero() &&
294+
retry_policy.max_backoff > SecondsDecimal::zero() &&
295+
retry_policy.backoff_multiplier > 0.0f)
296+
? 0
297+
: retry_policy.max_attempts),
293298
response_code_(0)
294299
{
295300
/* get a curl handle */

0 commit comments

Comments
 (0)