diff --git a/src/runboat/controller.py b/src/runboat/controller.py index f9bd1d6..bd115d2 100644 --- a/src/runboat/controller.py +++ b/src/runboat/controller.py @@ -85,7 +85,7 @@ class Controller: @property def deployed(self) -> int: - return self.db.count_all() + return self.db.count_deployed() @property def max_deployed(self) -> int: diff --git a/src/runboat/db.py b/src/runboat/db.py index 80be144..4c531af 100644 --- a/src/runboat/db.py +++ b/src/runboat/db.py @@ -170,6 +170,13 @@ class BuildsDb: count = self._con.execute("SELECT COUNT(name) FROM builds").fetchone()[0] return cast(int, count) + def count_deployed(self) -> int: + count = self._con.execute( + "SELECT COUNT(name) FROM builds WHERE status!=?", + (BuildStatus.undeploying,), + ).fetchone()[0] + return cast(int, count) + def to_cleanup(self) -> list[Build]: rows = self._con.execute( "SELECT * FROM builds WHERE status=? ORDER BY created",