forked from lix-project/hydra
Update to latest nixUnstable
This commit is contained in:
parent
d676c91bd5
commit
6517446c34
|
@ -231,9 +231,9 @@ void State::buildRemote(ref<Store> destStore,
|
||||||
|
|
||||||
/* Copy the input closure. */
|
/* Copy the input closure. */
|
||||||
if (/* machine->sshName != "localhost" */ true) {
|
if (/* machine->sshName != "localhost" */ true) {
|
||||||
auto mc1 = std::make_shared<MaintainCount>(nrStepsWaiting);
|
auto mc1 = std::make_shared<MaintainCount<counter>>(nrStepsWaiting);
|
||||||
mc1.reset();
|
mc1.reset();
|
||||||
MaintainCount mc2(nrStepsCopyingTo);
|
MaintainCount<counter> mc2(nrStepsCopyingTo);
|
||||||
printMsg(lvlDebug, format("sending closure of ‘%1%’ to ‘%2%’") % step->drvPath % machine->sshName);
|
printMsg(lvlDebug, format("sending closure of ‘%1%’ to ‘%2%’") % step->drvPath % machine->sshName);
|
||||||
|
|
||||||
auto now1 = std::chrono::steady_clock::now();
|
auto now1 = std::chrono::steady_clock::now();
|
||||||
|
@ -276,7 +276,7 @@ void State::buildRemote(ref<Store> destStore,
|
||||||
result.startTime = time(0);
|
result.startTime = time(0);
|
||||||
int res;
|
int res;
|
||||||
{
|
{
|
||||||
MaintainCount mc(nrStepsBuilding);
|
MaintainCount<counter> mc(nrStepsBuilding);
|
||||||
res = readInt(from);
|
res = readInt(from);
|
||||||
}
|
}
|
||||||
result.stopTime = time(0);
|
result.stopTime = time(0);
|
||||||
|
@ -371,7 +371,7 @@ void State::buildRemote(ref<Store> destStore,
|
||||||
|
|
||||||
/* Copy the output paths. */
|
/* Copy the output paths. */
|
||||||
if (/* machine->sshName != "localhost" */ true) {
|
if (/* machine->sshName != "localhost" */ true) {
|
||||||
MaintainCount mc(nrStepsCopyingFrom);
|
MaintainCount<counter> mc(nrStepsCopyingFrom);
|
||||||
|
|
||||||
auto now1 = std::chrono::steady_clock::now();
|
auto now1 = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
typedef std::atomic<unsigned long> counter;
|
|
||||||
|
|
||||||
struct MaintainCount
|
|
||||||
{
|
|
||||||
counter & c;
|
|
||||||
MaintainCount(counter & c) : c(c) { c++; }
|
|
||||||
MaintainCount(counter & c, std::function<void(unsigned long)> warn) : c(c)
|
|
||||||
{
|
|
||||||
warn(++c);
|
|
||||||
}
|
|
||||||
~MaintainCount() { auto prev = c--; assert(prev); }
|
|
||||||
};
|
|
|
@ -105,13 +105,11 @@ State::State()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MaintainCount State::startDbUpdate()
|
nix::MaintainCount<counter> State::startDbUpdate()
|
||||||
{
|
{
|
||||||
return MaintainCount(nrActiveDbUpdates, [](unsigned long c) {
|
if (nrActiveDbUpdates > 6)
|
||||||
if (c > 6) {
|
printError("warning: %d concurrent database updates; PostgreSQL may be stalled", nrActiveDbUpdates.load());
|
||||||
printMsg(lvlError, format("warning: %d concurrent database updates; PostgreSQL may be stalled") % c);
|
return MaintainCount<counter>(nrActiveDbUpdates);
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -485,7 +483,7 @@ void State::notificationSender()
|
||||||
notificationSenderQueue_->pop();
|
notificationSenderQueue_->pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
MaintainCount mc(nrNotificationsInProgress);
|
MaintainCount<counter> mc(nrNotificationsInProgress);
|
||||||
|
|
||||||
printMsg(lvlChatty, format("sending notification about build %1%") % item.id);
|
printMsg(lvlChatty, format("sending notification about build %1%") % item.id);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#include "db.hh"
|
#include "db.hh"
|
||||||
#include "counter.hh"
|
|
||||||
#include "token-server.hh"
|
#include "token-server.hh"
|
||||||
|
|
||||||
#include "derivations.hh"
|
#include "derivations.hh"
|
||||||
|
@ -22,6 +21,8 @@ typedef unsigned int BuildID;
|
||||||
|
|
||||||
typedef std::chrono::time_point<std::chrono::system_clock> system_time;
|
typedef std::chrono::time_point<std::chrono::system_clock> system_time;
|
||||||
|
|
||||||
|
typedef std::atomic<unsigned long> counter;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
bsSuccess = 0,
|
bsSuccess = 0,
|
||||||
|
@ -439,7 +440,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
MaintainCount startDbUpdate();
|
nix::MaintainCount<counter> startDbUpdate();
|
||||||
|
|
||||||
/* Return a store object to store build results. */
|
/* Return a store object to store build results. */
|
||||||
nix::ref<nix::Store> getDestStore();
|
nix::ref<nix::Store> getDestStore();
|
||||||
|
|
Loading…
Reference in a new issue