Periodically clear orphaned build steps

These are build steps that remain "busy" in the database even though
they have finished, because they couldn't be updated (e.g. due to a
PostgreSQL connection problem). To prevent them from showing up as
busy in the "Machine status" page, we now periodically purge them.
This commit is contained in:
Eelco Dolstra
2016-04-13 16:18:35 +02:00
parent f3f661bac1
commit 077ed3f571
3 changed files with 54 additions and 0 deletions

View File

@ -362,6 +362,11 @@ private:
time_t lastStatusLogged = 0;
const int statusLogInterval = 300;
/* Steps that were busy while we encounted a PostgreSQL
error. These need to be cleared at a later time to prevent them
from showing up as busy until the queue runner is restarted. */
nix::Sync<std::set<std::pair<BuildID, int>>> orphanedSteps;
public:
State();