summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* Handle Retry-After by defaultJulian Andres Klode2024-11-181-1/+1
| | | | | | | | | | | | | | Let's get some feedback here. This is capped to 30s per retry, so a maximum of 90s per item that we delay the failure case. In the worst case, we hence have 90n seconds delay for n items. In a more realistic worse case however, the server likely does not collapse per-item, and we end up trying all items in a short burst so it seems more realistic we hit a 90s total delay. The bursty behavior may be suboptimal; we don't quite know, but it seems the specification of Retry-After is per-entity rather than per-host, so technically speaking it seems correct.
* http: use Retry-After HTTP header to optimize retriesFelix Moessbauer2024-11-183-5/+29
| | | | | | | | | | | | | | | | | | | Some mirrors like snapshot.debian.org apply strict http rate limits. While apt already has an exponential backoff mechanism implemented, this is not sufficient due to the following reasons: 1. all retries happen roughly at the same time 2. the retry-after information from the server is not used We fix this by improving the algorithm: First, if present, the timestamp or duration of the Retry-After header is added to the exponential backoff, optimizing for success-on-second-try. Second, a random delay is added (delay += [0, delay]) to distribute the retries to not immediately run into the limit again. To avoid super-long delays, this is capped by the configured maximum delay. This logic only becomes active if the option Acquire::Retries::HandleRetryAfter is enabled. Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
* string_view: Include missing headersJulian Andres Klode2024-11-171-0/+3
| | | | | | | | | Specifically the lack of the `string_view` include is causing compilation failures for rust-rust-apt. Running iwyu also adds `algorithm` for our use of `std::min`, and `iosfwd` for our use of `std::ostream` none of which seem to be causing build failures so far.
* Merge branch 'reefer' into 'main'Julian Andres Klode2024-11-146-59/+49
|\ | | | | | | | | DEFER See merge request apt-team/apt!392
| * fdopen() failing does not close the fdнаб2024-11-141-0/+2
| |
| * DEFER() moreнаб2024-11-146-58/+44
| |
| * DEFERнаб2024-11-141-4/+6
| |
* | Merge branch 'noref' into 'main'Julian Andres Klode2024-11-142-13/+13
|\ \ | | | | | | | | | | | | std::string_view const & -> std::string_view See merge request apt-team/apt!397
| * | std::string_view const & -> std::string_viewнаб2024-11-142-13/+13
| |/ | | | | | | Fixes: 2c03eed649068c8838d971ceeb1a09603dcc8e9c
* | Merge branch 'append' into 'main'Julian Andres Klode2024-11-143-6/+8
|\ \ | | | | | | | | | | | | (+=)+= -> append().append() See merge request apt-team/apt!398
| * | (+=)+= -> append().append()наб2024-11-143-6/+8
| |/
* | if APT_PKG_ABI > 600: using APT::StringView = std::string_view;наб2024-11-141-0/+6
| |
* | pkgTagSection::Tag constructors: std::string const& -> std::string_view ↵наб2024-11-142-14/+32
| | | | | | | | (always copied) [#if APT_PKG_ABI > 600]
* | apt-pkg/contrib/hashes.cc, apt-pkg/contrib/hashes.h: APT::StringView -> ↵наб2024-11-142-9/+16
| | | | | | | | std::string_view in private interface. Take std::string_view instead of std::string const& for HashString::HashString (not reused) [#if APT_PKG_ABI > 600]
* | Move StringViewCompareFast to strutil.hнаб2024-11-142-18/+19
| |
* | apt-pkg/tagfile.h: prepare for APT::StringView -> std::string_viewнаб2024-11-141-2/+2
|/
* apt-pkg/contrib/gpgv.cc: APT::StringView -> std::string_viewнаб2024-11-121-7/+7
|
* apt-pkg/deb/deblistparser.h: APT::StringView -> std::string_viewнаб2024-11-121-6/+5
|
* apt-pkg/deb/deblistparser.cc: APT::StringView -> std::string_viewнаб2024-11-121-30/+31
|
* apt-pkg/deb/debsrcrecords.h: APT::StringView -> std::string_viewнаб2024-11-121-7/+7
|
* apt-pkg/deb/debsrcrecords.cc: APT::StringView -> std::string_viewнаб2024-11-121-12/+12
|
* apt-pkg/pkgcachegen.cc, apt-pkg/pkgcachegen.h: APT::StringView -> ↵наб2024-11-124-123/+123
| | | | std::string_view
* apt-pkg/cachefilter-patterns.h, apt-pkg/cachefilter-patterns.cc: prepare for ↵наб2024-11-122-65/+66
| | | | APT::StringView -> std::string_view
* apt-pkg/acquire-item.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-7/+7
|
* apt-pkg/deb/debrecords.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-20/+20
|
* apt-pkg/deb/debmetaindex.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-7/+7
|
* apt-pkg/tagfile.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-1/+1
|
* apt-pkg/policy.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-4/+3
|
* apt-pkg/contrib/configuration.cc: prepare for APT::StringView -> ↵наб2024-11-121-40/+39
| | | | std::string_view
* apt-pkg/indexcopy.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-38/+38
|
* flCombine: try to reuse one of the strings when returningнаб2024-11-121-54/+54
|
* apt-pkg/edsp/edsplistparser.cc: APT::StringView -> std::string_viewнаб2024-11-126-13/+9
|
* apt-pkg/algorithms.cc, apt-pkg/cachefilter.h: drop unused #include ↵наб2024-11-122-2/+0
| | | | <apt-pkg/string_view.h>
* apt-pkg/edsp.cc: APT::StringView -> std::string_viewнаб2024-11-121-9/+8
|
* APT::StringView: add operator std::string_view(), StringViewCompareFast() ↵наб2024-11-121-4/+13
| | | | for std::string_views, operator<<(ostream&), std::string_view constructor, operator==(std::string_view)
* ReportMirrorFailureToCentral: fix use-after-freeнаб2024-11-121-1/+2
|
* Merge branch 'more' into 'main'Julian Andres Klode2024-11-129-105/+114
|\ | | | | | | | | APT_BUFFER_SIZE pkgTagFile default size. std::vector(1024) -> std::array<1024>. dpkgpm buffers See merge request apt-team/apt!390
| * dpkgpm: fdopen() failing doesn't close the fdнаб2024-11-121-0/+3
| |
| * dpkgpm: append ":$printarchitecture" instead of ':'+${#printarchitecture} to ↵наб2024-11-121-1/+1
| | | | | | | | package name
| * dpkgpm: use getline() for Apport var/crash linesнаб2024-11-121-18/+11
| | | | | | | | | | Also remove useless condition: sscanf() already direct-matches non-whitespace bytes
| * dpkgpm: use std::array<unsigned char, APT_BUFFER_SIZE> for I/O copy buffersнаб2024-11-121-7/+7
| |
| * dpkgpm: use sysconf(_SC_GETPW_R_SIZE_MAX)-sized + growing buffer for ↵наб2024-11-121-2/+7
| | | | | | | | getpwuid_r() instead of 255
| * pkgDPkgPMPrivate::dpkgbuf: char[1024] -> array<char, APT_BUFFER_SIZE>наб2024-11-121-8/+8
| |
| * dpkgpm: lift out CopyIndented() and make_unique_*() for FILEs; use getline() ↵наб2024-11-123-60/+55
| | | | | | | | for reading lines instead of 1k buffer
| * Turn unique_ptr<decltype(fclose and free)> into real deleter types (warnings ↵наб2024-11-125-13/+25
| | | | | | | | now, UB in C++20)
| * Bump pkgTagFile default Size from 32k to APT_BUFFER_SIZEнаб2024-11-111-4/+4
| |
| * Replace constant-size never-reallicated getservbyport_r() std::vector buffer ↵наб2024-11-111-1/+2
| | | | | | | | with std::array
* | FileFd::Open: don't needlessly copy filename in three-arg constructorнаб2024-11-111-2/+2
|/
* Turn std::unique_ptr<char[]/std::array<char>>(APT_BUFFER_SIZE) buffers into ↵наб2024-11-112-9/+8
| | | | std::array<char, APT_BUFFER_SIZE>
* Turn char[APT_BUFFER_SIZE] buffers into std::array<char, APT_BUFFER_SIZE>наб2024-11-112-26/+26
|