@@ -67,13 +67,6 @@ func terminalState(state swarm.TaskState) bool {
6767 return numberedStates [state ] > numberedStates [swarm .TaskStateRunning ]
6868}
6969
70- func stateToProgress (state swarm.TaskState , rollback bool ) int64 {
71- if ! rollback {
72- return numberedStates [state ]
73- }
74- return numberedStates [swarm .TaskStateRunning ] - numberedStates [state ]
75- }
76-
7770// ServiceProgress outputs progress information for convergence of a service.
7871// nolint: gocyclo
7972func ServiceProgress (ctx context.Context , client client.APIClient , serviceID string , progressWriter io.WriteCloser ) error {
@@ -343,7 +336,7 @@ func (u *replicatedProgressUpdater) update(service swarm.Service, tasks []swarm.
343336 running ++
344337 }
345338
346- u .writeTaskProgress (task , mappedSlot , replicas , rollback )
339+ u .writeTaskProgress (task , mappedSlot , replicas )
347340 }
348341
349342 if ! u .done {
@@ -389,7 +382,7 @@ func (u *replicatedProgressUpdater) tasksBySlot(tasks []swarm.Task, activeNodes
389382 return tasksBySlot
390383}
391384
392- func (u * replicatedProgressUpdater ) writeTaskProgress (task swarm.Task , mappedSlot int , replicas uint64 , rollback bool ) {
385+ func (u * replicatedProgressUpdater ) writeTaskProgress (task swarm.Task , mappedSlot int , replicas uint64 ) {
393386 if u .done || replicas > maxProgressBars || uint64 (mappedSlot ) > replicas {
394387 return
395388 }
@@ -406,7 +399,7 @@ func (u *replicatedProgressUpdater) writeTaskProgress(task swarm.Task, mappedSlo
406399 u .progressOut .WriteProgress (progress.Progress {
407400 ID : fmt .Sprintf ("%d/%d" , mappedSlot , replicas ),
408401 Action : fmt .Sprintf ("%-[1]*s" , longestState , task .Status .State ),
409- Current : stateToProgress ( task .Status .State , rollback ) ,
402+ Current : numberedStates [ task .Status .State ] ,
410403 Total : maxProgress ,
411404 HideCounts : true ,
412405 })
@@ -463,7 +456,7 @@ func (u *globalProgressUpdater) update(service swarm.Service, tasks []swarm.Task
463456 running ++
464457 }
465458
466- u .writeTaskProgress (task , nodeCount , rollback )
459+ u .writeTaskProgress (task , nodeCount )
467460 }
468461 }
469462
@@ -507,7 +500,7 @@ func (u *globalProgressUpdater) tasksByNode(tasks []swarm.Task) map[string]swarm
507500 return tasksByNode
508501}
509502
510- func (u * globalProgressUpdater ) writeTaskProgress (task swarm.Task , nodeCount int , rollback bool ) {
503+ func (u * globalProgressUpdater ) writeTaskProgress (task swarm.Task , nodeCount int ) {
511504 if u .done || nodeCount > maxProgressBars {
512505 return
513506 }
@@ -524,7 +517,7 @@ func (u *globalProgressUpdater) writeTaskProgress(task swarm.Task, nodeCount int
524517 u .progressOut .WriteProgress (progress.Progress {
525518 ID : stringid .TruncateID (task .NodeID ),
526519 Action : fmt .Sprintf ("%-[1]*s" , longestState , task .Status .State ),
527- Current : stateToProgress ( task .Status .State , rollback ) ,
520+ Current : numberedStates [ task .Status .State ] ,
528521 Total : maxProgress ,
529522 HideCounts : true ,
530523 })
0 commit comments