Skip to content

Commit

Permalink
Fix RestartStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
Lqp1 authored and komuta committed Aug 14, 2020
1 parent 99bbcf3 commit 1f27123
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class DeploymentManagerActor(
val s = sender()
healthCheckManager.statuses(appId) onComplete {
case Success(r) =>
//TODO(t.lange): Add ReadinessCheck
s ! HealthStatusResponse(r)
case Failure(e) => logger.error(s"Failed to send health status to TaskReplaceActor!", e)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ object TaskReplaceActor extends StrictLogging {

val minHealthy = (runSpec.instances * runSpec.upgradeStrategy.minimumHealthCapacity).ceil.toInt
var maxCapacity = (runSpec.instances * (1 + runSpec.upgradeStrategy.maximumOverCapacity)).toInt
var nrToKillImmediately = math.max(0, consideredHealthyInstancesCount - minHealthy)
var nrToKillImmediately = math.min(math.max(0, consideredHealthyInstancesCount - minHealthy), state.oldInstances)

if (minHealthy == maxCapacity && maxCapacity <= consideredHealthyInstancesCount) {
if (runSpec.isResident) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,8 @@ class TaskReplaceActorTest extends AkkaUnitTest with Eventually {
// and we can check deployment continue as usual
eventually {
verify(f.tracker, times(1)).setGoal(any, any, any)
}
f.sendState(app, newApp, ref, oldInstances, newInstances, 0, 1)
eventually {
verify(f.queue, times(1)).add(newApp, 1)
}

f.sendState(app, newApp, ref, oldInstances, newInstances, 0, 2)
promise.future.futureValue
expectTerminated(ref)
Expand Down

0 comments on commit 1f27123

Please sign in to comment.