@@ -489,7 +489,7 @@ bool HttpClient::MaybeSpawnBackgroundThread()
489
489
490
490
if (operation->IsRetryable ())
491
491
{
492
- self->pending_to_retry_sessions_ .push_front (hold_session);
492
+ self->pending_to_retry_sessions_ .push_back (hold_session);
493
493
}
494
494
}
495
495
}
@@ -797,26 +797,25 @@ bool HttpClient::doRetrySessions()
797
797
auto has_data = false ;
798
798
799
799
// Assumptions:
800
- // - This is a FIFO list so older sessions, pushed at the front , always end up at the tail
800
+ // - This is a FIFO list so older sessions, pushed at the back , always end up at the front
801
801
// - Locking not required because only the background thread would be pushing to this container
802
802
// - Retry policy is not changed once HTTP client is initialized, so same settings for everyone
803
- // - Iterating backwards should result in removing items with minimal or no compacting required
804
- for (auto retry_it = pending_to_retry_sessions_.crbegin ();
805
- retry_it != pending_to_retry_sessions_.crend ();)
803
+ for (auto retry_it = pending_to_retry_sessions_.cbegin ();
804
+ retry_it != pending_to_retry_sessions_.cend ();)
806
805
{
807
806
const auto session = *retry_it;
808
807
const auto operation = session ? session->GetOperation ().get () : nullptr ;
809
808
810
809
if (!operation)
811
810
{
812
- retry_it = decltype (retry_it){ pending_to_retry_sessions_.erase (std::next ( retry_it). base ())} ;
811
+ retry_it = pending_to_retry_sessions_.erase (retry_it);
813
812
}
814
813
else if (operation->NextRetryTime () < now)
815
814
{
816
815
auto easy_handle = operation->GetCurlEasyHandle ();
817
816
curl_multi_remove_handle (multi_handle_, easy_handle);
818
817
curl_multi_add_handle (multi_handle_, easy_handle);
819
- retry_it = decltype (retry_it){ pending_to_retry_sessions_.erase (std::next ( retry_it). base ())} ;
818
+ retry_it = pending_to_retry_sessions_.erase (retry_it);
820
819
has_data = true ;
821
820
}
822
821
else
0 commit comments