From a9587b39ea6776b1d1324288786176102f65cee5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 10 Feb 2025 19:56:16 +0100 Subject: solver3: Implement a timeout, default 10s A SAT solver can run more or less forever, but that's not a good user experience. --- apt-pkg/solver3.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apt-pkg/solver3.h') diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h index 34da03ea0..da75179d5 100644 --- a/apt-pkg/solver3.h +++ b/apt-pkg/solver3.h @@ -213,6 +213,9 @@ class Solver // This is an index into the solved vector. std::vector choices{}; + // \brief The time we called Solve() + time_t startTime; + /// Various configuration options // \brief Debug level int debug{_config->FindI("Debug::APT::Solver")}; @@ -232,6 +235,8 @@ class Solver bool FixPolicyBroken{_config->FindB("APT::Get::Fix-Policy-Broken")}; // \brief If set, we use strict pinning. bool DeferVersionSelection{_config->FindB("APT::Solver::Defer-Version-Selection", true)}; + // \brief If set, we use strict pinning. + int Timeout{_config->FindI("APT::Solver::Timeout", 10)}; // \brief Discover a variable, translating the underlying dependencies to the SAT presentation // -- cgit v1.2.3-70-g09d2