Prefer cached failure over unsupported system type

This commit is contained in:
Eelco Dolstra 2015-06-16 18:00:39 +02:00
parent a984c0badc
commit e02654b3a0

View file

@ -197,12 +197,6 @@ private:
typedef std::list<Machine::ptr> Machines; typedef std::list<Machine::ptr> Machines;
Sync<Machines> machines; Sync<Machines> 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<std::thread> builderThreads;
/* Various stats. */ /* Various stats. */
std::atomic<int> nrQueueWakeups; std::atomic<int> nrQueueWakeups;
@ -536,25 +530,27 @@ void State::getQueuedBuilds(Connection & conn, std::shared_ptr<StoreAPI> store,
BuildStatus buildStatus = bsSuccess; BuildStatus buildStatus = bsSuccess;
BuildStepStatus buildStepStatus = bssFailed; 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)) { if (checkCachedFailure(r, conn)) {
printMsg(lvlError, format("marking build %1% as cached failure") % build->id); printMsg(lvlError, format("marking build %1% as cached failure") % build->id);
buildStatus = step == r ? bsFailed : bsFailed; buildStatus = step == r ? bsFailed : bsFailed;
buildStepStatus = bssFailed; 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) { if (buildStatus != bsSuccess) {
time_t now = time(0); time_t now = time(0);
pqxx::work txn(conn); pqxx::work txn(conn);