Merge branch 'f-7422-scaling-events' of github.com:hashicorp/nomad into f-7422-scaling-events

This commit is contained in:
Chris Baker 2020-04-01 17:28:50 +00:00
commit 285728f3fa
2 changed files with 3 additions and 3 deletions

View File

@ -934,7 +934,7 @@ func (j *Job) Scale(args *structs.JobScaleRequest, reply *structs.JobRegisterRes
reply.JobModifyIndex = job.ModifyIndex reply.JobModifyIndex = job.ModifyIndex
} }
// only create an eval for non-dispatch jobs and if the count was provided // Only create an eval for non-dispatch jobs and if the count was provided
// for now, we'll do this even if count didn't change // for now, we'll do this even if count didn't change
if !job.IsPeriodic() && !job.IsParameterized() && args.Count != nil { if !job.IsPeriodic() && !job.IsParameterized() && args.Count != nil {
eval := &structs.Evaluation{ eval := &structs.Evaluation{

View File

@ -654,12 +654,12 @@ func (s *StateStore) UpsertScalingEvent(index uint64, req *structs.ScalingEventR
req.ScalingEvent.CreateIndex = index req.ScalingEvent.CreateIndex = index
events := jobEvents.ScalingEvents[req.TaskGroup] events := jobEvents.ScalingEvents[req.TaskGroup]
// prepend this latest event // Prepend this latest event
events = append( events = append(
[]*structs.ScalingEvent{req.ScalingEvent}, []*structs.ScalingEvent{req.ScalingEvent},
events..., events...,
) )
// truncate older events // Truncate older events
if len(events) > structs.JobTrackedScalingEvents { if len(events) > structs.JobTrackedScalingEvents {
events = events[0:structs.JobTrackedScalingEvents] events = events[0:structs.JobTrackedScalingEvents]
} }