@@ -489,7 +489,7 @@ bool HttpClient::MaybeSpawnBackgroundThread()
489489
490490 if (operation->IsRetryable ())
491491 {
492- self->pending_to_retry_sessions_ .push_front (hold_session);
492+ self->pending_to_retry_sessions_ .push_back (hold_session);
493493 }
494494 }
495495 }
@@ -797,26 +797,25 @@ bool HttpClient::doRetrySessions()
797797 auto has_data = false ;
798798
799799 // 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
801801 // - Locking not required because only the background thread would be pushing to this container
802802 // - 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 ();)
806805 {
807806 const auto session = *retry_it;
808807 const auto operation = session ? session->GetOperation ().get () : nullptr ;
809808
810809 if (!operation)
811810 {
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);
813812 }
814813 else if (operation->NextRetryTime () < now)
815814 {
816815 auto easy_handle = operation->GetCurlEasyHandle ();
817816 curl_multi_remove_handle (multi_handle_, easy_handle);
818817 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);
820819 has_data = true ;
821820 }
822821 else
0 commit comments