fix: getTeam works when there are no teams

This commit is contained in:
Evan Tschannen 2018-01-17 17:49:13 -08:00
parent 264dc44dfa
commit 2e46ee3dba
1 changed files with 4 additions and 11 deletions

View File

@ -468,7 +468,6 @@ struct DDTeamCollection {
Promise<Void> serverTrackerErrorOut;
AsyncVar<int> recruitingStream;
Debouncer restartRecruiting;
Promise<Void> hasTeams;
int healthyTeamCount;
PromiseStream<Void> zeroHealthyTeams;
@ -562,7 +561,6 @@ struct DDTeamCollection {
// use keys, src, dest, metrics, priority, system load, etc.. to decide...
ACTOR Future<Void> getTeam( DDTeamCollection* self, GetTeamRequest req ) {
try {
Void _ = wait( self->hasTeams.getFuture() );
Void _ = wait( self->checkBuildTeams( self ) );
// Select the best team
@ -634,7 +632,10 @@ struct DDTeamCollection {
}
}
ASSERT( self->teams.size() );
if( !self->teams.size() ) {
req.reply.send( Optional<Reference<IDataDistributionTeam>>() );
return Void();
}
if( req.wantsTrueBest ) {
ASSERT( !bestOption.present() );
@ -730,10 +731,6 @@ struct DDTeamCollection {
addTeam(t->begin(), t->end() );
}
if( teams.size() && hasTeams.canBeSet() ) {
hasTeams.send(Void());
}
addSubsetOfEmergencyTeams();
}
@ -1040,10 +1037,6 @@ struct DDTeamCollection {
//Let all of these changes get worked out before responding to the get team request
Void _ = wait( delay(0, TaskDataDistributionLaunch) );
if( self->teams.size() && self->hasTeams.canBeSet() ) {
self->hasTeams.send(Void());
}
return Void();
}