Fix the initial progress deadline calculation when the alloc is inplace updated to be part of a new deployment

This commit is contained in:
Alex Dadgar
2018-04-27 16:54:51 -07:00
committed by Preetha Appan
parent 801d147e83
commit 3701ee09c8

View File

@@ -3340,9 +3340,11 @@ func (s *StateStore) updateDeploymentWithAlloc(index uint64, alloc, existing *st
// Update the progress deadline
if pd := state.ProgressDeadline; pd != 0 {
// If we are the first placed allocation start the progress deadline.
// If we are the first placed allocation for the deployment start the progress deadline.
if placed != 0 && state.RequireProgressBy.IsZero() {
state.RequireProgressBy = time.Unix(0, alloc.CreateTime).Add(pd)
// Use modify time instead of create time becasue we may in-place
// update the allocation to be part of a new deployment.
state.RequireProgressBy = time.Unix(0, alloc.ModifyTime).Add(pd)
} else if healthy != 0 {
if d := alloc.DeploymentStatus.Timestamp.Add(pd); d.After(state.RequireProgressBy) {
state.RequireProgressBy = d