Acquire exclusive table lock earlier

This commit is contained in:
Eelco Dolstra 2015-06-18 02:44:29 +02:00
parent 69be3cfe93
commit 8257812d0a

View file

@ -601,13 +601,13 @@ void State::getQueuedBuilds(Connection & conn, std::shared_ptr<StoreAPI> store,
if (buildStatus != bsSuccess) {
time_t now = time(0);
pqxx::work txn(conn);
createBuildStep(txn, 0, build, r, "", buildStepStatus);
txn.parameterized
("update Builds set finished = 1, busy = 0, buildStatus = $2, startTime = $3, stopTime = $3, isCachedBuild = $4 where id = $1")
(build->id)
((int) buildStatus)
(now)
(buildStatus != bsUnsupported ? 1 : 0).exec();
createBuildStep(txn, 0, build, r, "", buildStepStatus);
txn.commit();
nrBuildsDone++;
badStep = true;