github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/actor/v7pushaction/restart_application.go (about) 1 package v7pushaction 2 3 import ( 4 log "github.com/sirupsen/logrus" 5 ) 6 7 func (actor Actor) RestartApplication(pushPlan PushPlan, eventStream chan<- *PushEvent, progressBar ProgressBar) (PushPlan, Warnings, error) { 8 log.Info("Restarting Application") 9 10 var allWarnings Warnings 11 12 eventStream <- &PushEvent{Plan: pushPlan, Event: RestartingApplication} 13 14 warnings, err := actor.V7Actor.RestartApplication(pushPlan.Application.GUID, pushPlan.NoWait) 15 allWarnings = append(allWarnings, Warnings(warnings)...) 16 if err != nil { 17 return pushPlan, allWarnings, err 18 } 19 20 handleInstanceDetails := func(instanceDetails string) { 21 eventStream <- &PushEvent{ 22 Plan: pushPlan, 23 Warnings: Warnings{instanceDetails}, 24 Event: InstanceDetails, 25 } 26 } 27 28 warnings, err = actor.V7Actor.PollStart(pushPlan.Application, pushPlan.NoWait, handleInstanceDetails) 29 30 allWarnings = append(allWarnings, Warnings(warnings)...) 31 if err != nil { 32 return pushPlan, allWarnings, err 33 } 34 35 eventStream <- &PushEvent{Plan: pushPlan, Event: RestartingApplicationComplete} 36 37 return pushPlan, allWarnings, nil 38 }