hydra-queue-runner: Fix assertion failure
It was hitting assert(reservation.unique()); Since we do want the machine reservation to be released before calling wakeDispatcher(), let's use a different object for keeping track of active steps.
This commit is contained in:
parent
07decd6915
commit
4f08c85c69
|
@ -13,13 +13,14 @@ void State::builder(MachineReservation::ptr reservation)
|
|||
|
||||
nrStepsStarted++;
|
||||
|
||||
reservation->threadId = pthread_self();
|
||||
|
||||
activeSteps_.lock()->insert(reservation);
|
||||
auto activeStep = std::make_shared<ActiveStep>();
|
||||
activeStep->step = reservation->step;
|
||||
activeStep->threadId = pthread_self();
|
||||
activeSteps_.lock()->insert(activeStep);
|
||||
|
||||
Finally removeActiveStep([&]() {
|
||||
reservation->threadId = -1;
|
||||
activeSteps_.lock()->erase(reservation);
|
||||
activeStep->threadId = -1;
|
||||
activeSteps_.lock()->erase(activeStep);
|
||||
});
|
||||
|
||||
auto step = reservation->step;
|
||||
|
|
|
@ -370,13 +370,17 @@ private:
|
|||
State & state;
|
||||
Step::ptr step;
|
||||
Machine::ptr machine;
|
||||
pthread_t threadId = 0;
|
||||
bool cancelled = false;
|
||||
MachineReservation(State & state, Step::ptr step, Machine::ptr machine);
|
||||
~MachineReservation();
|
||||
};
|
||||
|
||||
nix::Sync<std::set<std::shared_ptr<MachineReservation>>> activeSteps_;
|
||||
struct ActiveStep
|
||||
{
|
||||
Step::ptr step;
|
||||
pthread_t threadId;
|
||||
};
|
||||
|
||||
nix::Sync<std::set<std::shared_ptr<ActiveStep>>> activeSteps_;
|
||||
|
||||
std::atomic<time_t> lastDispatcherCheck{0};
|
||||
|
||||
|
|
Loading…
Reference in a new issue