TeamCollection:Count healthy machine teams only

Team collection should prioritize to build machine teams for a machine
that has the least number of healthy machine teams, instead of just
machine teams, because unhealthy machine team will not be able to
produce more server teams.
This commit is contained in:
Meng Xu 2019-06-26 17:30:29 -07:00
parent ee916b337d
commit e1d459075a
1 changed files with 6 additions and 1 deletions

View File

@ -1342,7 +1342,12 @@ struct DDTeamCollection : ReferenceCounted<DDTeamCollection> {
// Invariant: We only create correct size machine teams.
// When configuration (e.g., team size) is changed, the DDTeamCollection will be destroyed and rebuilt
// so that the invariant will not be violated.
int teamCount = machine.second->machineTeams.size();
int teamCount = 0;
for (auto& mt : machine.second->machineTeams) {
if ( isMachineTeamHealthy(mt) ) {
++teamCount;
}
}
if (teamCount < minTeamCount) {
leastUsedMachines.clear();