@@ -146,8 +146,8 @@ func (p *AppPushOperation) pushBlueGreenApp(ctx context.Context, space *resource
146146 }
147147
148148 if newApp .State == "STARTED" {
149-
150- healthCheckErr := p .waitForAppHealthy (ctx , newApp )
149+ pollOptions := p . getAppDeployedRunningPollingOptions ( ctx )
150+ healthCheckErr := p .waitForAppHealthy (ctx , newApp , pollOptions )
151151 // If health check fails, delete new app and change back original app name
152152 if healthCheckErr != nil {
153153 originalName := newApp .Name
@@ -171,7 +171,7 @@ func (p *AppPushOperation) pushBlueGreenApp(ctx context.Context, space *resource
171171 return newApp , fmt .Errorf ("failed to verify application start: %w" , pushError )
172172}
173173
174- func getAppDeployedRunningPollingOptions (ctx context.Context ) ( uint , uint ) {
174+ func ( p * AppPushOperation ) getAppDeployedRunningPollingOptions (ctx context.Context ) * client. PollingOptions {
175175 rawTimeout := ctx .Value ("app_deployed_running_timeout" )
176176 processedTimeout := uint (AppDeployedRunningTimeoutMinutesDefault )
177177
@@ -200,7 +200,10 @@ func getAppDeployedRunningPollingOptions(ctx context.Context) (uint, uint) {
200200 }
201201 }
202202
203- return processedTimeout , processedCheckInterval
203+ pollOptions := client .NewPollingOptions ()
204+ pollOptions .Timeout = time .Duration (processedTimeout ) * time .Minute
205+ pollOptions .CheckInterval = time .Duration (processedCheckInterval ) * time .Second
206+ return pollOptions
204207}
205208
206209func (p * AppPushOperation ) pushRollingApp (ctx context.Context , space * resource.Space , manifest * AppManifest , zipFile io.Reader ) (* resource.App , error ) {
@@ -564,11 +567,7 @@ func (p *AppPushOperation) findSpace(ctx context.Context, orgGUID string) (*reso
564567 return space , nil
565568}
566569
567- func (p * AppPushOperation ) waitForAppHealthy (ctx context.Context , app * resource.App ) error {
568- timeout , checkInterval := getAppDeployedRunningPollingOptions (ctx )
569- pollOptions := client .NewPollingOptions ()
570- pollOptions .Timeout = time .Duration (timeout ) * time .Minute
571- pollOptions .CheckInterval = time .Duration (checkInterval ) * time .Second
570+ func (p * AppPushOperation ) waitForAppHealthy (ctx context.Context , app * resource.App , pollOptions * client.PollingOptions ) error {
572571 appPollErr := client .PollForStateOrTimeout (func () (string , string , error ) {
573572 for {
574573 procData , err := p .client .Processes .GetStatsForApp (ctx , app .GUID , "web" )
0 commit comments