From e02654b3a02659b364b2e89c2f48e1c368729aa7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 16 Jun 2015 18:00:39 +0200 Subject: [PATCH] Prefer cached failure over unsupported system type --- src/hydra-queue-runner/hydra-queue-runner.cc | 34 +++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index 1204ed0b..d59bef1e 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -197,12 +197,6 @@ private: typedef std::list Machines; Sync machines; - /* The currently active builder threads. FIXME: We could re-use - these, but since they're fairly long-running, it's probably not - worth it. */ - // std::vector builderThreads; - - /* Various stats. */ std::atomic nrQueueWakeups; @@ -536,25 +530,27 @@ void State::getQueuedBuilds(Connection & conn, std::shared_ptr store, BuildStatus buildStatus = bsSuccess; BuildStepStatus buildStepStatus = bssFailed; - bool supported = false; - { - auto machines_(machines.lock()); // FIXME: use shared_mutex - for (auto & m : *machines_) - if (m->supportsStep(r)) { supported = true; break; } - } - - if (!supported) { - printMsg(lvlError, format("aborting unsupported build %1%") % build->id); - buildStatus = bsUnsupported; - buildStepStatus = bssUnsupported; - } - if (checkCachedFailure(r, conn)) { printMsg(lvlError, format("marking build %1% as cached failure") % build->id); buildStatus = step == r ? bsFailed : bsFailed; buildStepStatus = bssFailed; } + if (buildStatus == bsSuccess) { + bool supported = false; + { + auto machines_(machines.lock()); // FIXME: use shared_mutex + for (auto & m : *machines_) + if (m->supportsStep(r)) { supported = true; break; } + } + + if (!supported) { + printMsg(lvlError, format("aborting unsupported build %1%") % build->id); + buildStatus = bsUnsupported; + buildStepStatus = bssUnsupported; + } + } + if (buildStatus != bsSuccess) { time_t now = time(0); pqxx::work txn(conn);