Skip to content

Commit

Permalink
Updated service creation check from a fixed timeout value to an
Browse files Browse the repository at this point in the history
indefinite loop. This mitigates for service provisioning processes
that require user ticket approvals or that it takes a long
unknown length of time.
  • Loading branch information
David Wu committed Mar 11, 2019
1 parent e1e9a3a commit 9f65407
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion createServicePush/createServicePush.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (c *CreateServicePush) GetMetadata() plugin.PluginMetadata {
Version: plugin.VersionType{
Major: 1,
Minor: 3,
Build: 0,
Build: 1,
},
MinCliVersion: plugin.VersionType{
Major: 6,
Expand Down
10 changes: 4 additions & 6 deletions serviceCreator/serviceCreator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"net/url"
"strings"
"time"

"code.cloudfoundry.org/cli/plugin"
"github.com/dawu415/CF-CLI-Create-Service-Push-Plugin/serviceManifest"
Expand Down Expand Up @@ -238,11 +237,10 @@ func (c *ServiceCreator) createService(name, broker, plan, JSONParam, tags strin
}

// Now wait for the service creation to complete.
// serviceCreationTimeout is in seconds waiting for service to complete
var serviceCreationTimeout = time.Duration(900) * time.Second
startTime := time.Now()

for time.Duration(time.Since(startTime)) <= serviceCreationTimeout {
// We wait 'infinitely' here because we don't know how long the service
// will take to complete. There exists some service brokers where
// provisioning requires user ticket approval input to complete.
for {
service, err := c.cf.GetService(name)
if err != nil {
return err
Expand Down

0 comments on commit 9f65407

Please sign in to comment.