Skip to content

Commit

Permalink
Address some code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
preetapan committed Nov 2, 2017
1 parent 96b01c7 commit a8211b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 4 additions & 3 deletions command/alloc_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ func (c *AllocStatusCommand) outputTaskStatus(state *api.TaskState) {
for i, event := range state.Events {
if event.DisplayMessage != "" {
formattedTime := formatUnixNanoTime(event.Time)
events[size-i] = fmt.Sprintf("%s|%s|%s", formattedTime, event.Type, event.DisplayMessage)
formattedDisplayMsg := fmt.Sprintf("%s|%s|%s", formattedTime, event.Type, event.DisplayMessage)
events[size-i] = formattedDisplayMsg
} else {
events[size-i] = buildDisplayMessage(event)
}
Expand All @@ -336,7 +337,7 @@ func (c *AllocStatusCommand) outputTaskStatus(state *api.TaskState) {
}

func buildDisplayMessage(event *api.TaskEvent) string {
formatedTime := formatUnixNanoTime(event.Time)
formattedTime := formatUnixNanoTime(event.Time)

// Build up the description based on the event type.
var desc string
Expand Down Expand Up @@ -447,7 +448,7 @@ func buildDisplayMessage(event *api.TaskEvent) string {
}

// Reverse order so we are sorted by time
return fmt.Sprintf("%s|%s|%s", formatedTime, event.Type, desc)
return fmt.Sprintf("%s|%s|%s", formattedTime, event.Type, desc)
}

// outputTaskResources prints the task resources for the passed task and if
Expand Down
4 changes: 0 additions & 4 deletions nomad/node_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,10 +827,6 @@ func (n *Node) UpdateAlloc(args *structs.AllocUpdateRequest, reply *structs.Gene
}
// Add this to the batch
n.updatesLock.Lock()
now := time.Now().UTC().UnixNano()
for _, alloc := range args.Alloc {
alloc.ModifyTime = now
}
n.updates = append(n.updates, args.Alloc...)

// Start a new batch if none
Expand Down

0 comments on commit a8211b1

Please sign in to comment.