Ignore undeploying builds when counting deployed
Otherwise the undeployer evicts too many builds as it loops until the first builds are actually deleted.
This commit is contained in:
parent
b873d09d22
commit
b21a7c92f8
2 changed files with 8 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in a new issue