From e9b480db173a84acb76d632ee5e6e393a5827cdc Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 26 Jun 2024 16:38:17 +0300 Subject: Sleep for 1 second after installing system/distribution packages for Debian and Fedora --- bpkg/system-package-manager-debian.cxx | 9 +++++++++ bpkg/system-package-manager-fedora.cxx | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/bpkg/system-package-manager-debian.cxx b/bpkg/system-package-manager-debian.cxx index 8b27e37..b772352 100644 --- a/bpkg/system-package-manager-debian.cxx +++ b/bpkg/system-package-manager-debian.cxx @@ -4,6 +4,8 @@ #include #include +#include // this_thread::sleep_for() +#include #include #include // permissions @@ -1487,6 +1489,13 @@ namespace bpkg } apt_get_install (specs); + + // Note that installing packages on Debian and Debian-like distributions + // may end up with asynchronous restart of some system services. That, + // in particular, may result in the network short-term unavailability. + // Thus, let's pause for a while before fetching the source packages. + // + std::this_thread::sleep_for (std::chrono::seconds (1)); } // Verify that versions we have promised in status() match what actually diff --git a/bpkg/system-package-manager-fedora.cxx b/bpkg/system-package-manager-fedora.cxx index 3b79c50..78d1739 100644 --- a/bpkg/system-package-manager-fedora.cxx +++ b/bpkg/system-package-manager-fedora.cxx @@ -4,6 +4,8 @@ #include #include +#include // this_thread::sleep_for() +#include #include @@ -1810,8 +1812,18 @@ namespace bpkg // Install. // if (install) + { dnf_install (specs); + // Note that installing packages on Fedora and Fedora-like distributions + // may end up with asynchronous restart of some system services (see the + // %systemd_postun_with_restart RPM macro for details). That, in + // particular, may result in the network short-term unavailability. + // Thus, let's pause for a while before fetching the source packages. + // + std::this_thread::sleep_for (std::chrono::seconds (1)); + } + // Mark as installed by the user. // dnf_mark_install (specs); -- cgit v1.1