aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-06-26 16:38:17 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-06-26 20:21:28 +0300
commite9b480db173a84acb76d632ee5e6e393a5827cdc (patch)
tree839419c8c357c70b5859aa5424cba3daff6cd5db
parentad1de8623e8672c9d04103d400ead6fa250f59d8 (diff)
Sleep for 1 second after installing system/distribution packages for Debian and Fedora
-rw-r--r--bpkg/system-package-manager-debian.cxx9
-rw-r--r--bpkg/system-package-manager-fedora.cxx12
2 files changed, 21 insertions, 0 deletions
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 <bpkg/system-package-manager-debian.hxx>
#include <locale>
+#include <thread> // this_thread::sleep_for()
+#include <chrono>
#include <libbutl/timestamp.hxx>
#include <libbutl/filesystem.hxx> // 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 <bpkg/system-package-manager-fedora.hxx>
#include <locale>
+#include <thread> // this_thread::sleep_for()
+#include <chrono>
#include <bpkg/diagnostics.hxx>
@@ -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);