Skip to content

Commit

Permalink
Sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
emilniklas committed Dec 17, 2020
1 parent 9a45145 commit 446a5b2
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions netlify/resource_branch_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/netlify/open-api/go/models"
"github.com/netlify/open-api/go/plumbing/operations"
"sync"
"time"
)

func resourceBranchDeploy() *schema.Resource {
Expand Down Expand Up @@ -66,8 +67,15 @@ func resourceBranchDeployCreate(d *schema.ResourceData, metaRaw interface{}) err
},
}
_, err = meta.Netlify.Operations.UpdateSite(patch, meta.AuthInfo)

if err != nil {
return err
}

d.SetId(branch)
return err
time.Sleep(time.Second * 3)

return nil
}

func resourceBranchDeployRead(d *schema.ResourceData, metaRaw interface{}) error {
Expand All @@ -94,6 +102,8 @@ func resourceBranchDeployRead(d *schema.ResourceData, metaRaw interface{}) error

d.SetId("")

time.Sleep(time.Second * 3)

return nil
}

Expand Down Expand Up @@ -133,7 +143,13 @@ func resourceBranchDeployUpdate(d *schema.ResourceData, metaRaw interface{}) err

_, err = meta.Netlify.Operations.UpdateSite(params, meta.AuthInfo)

return err
if err != nil {
return err
}

time.Sleep(time.Second * 3)

return nil
}

func resourceBranchDeployDelete(d *schema.ResourceData, metaRaw interface{}) error {
Expand Down Expand Up @@ -172,7 +188,13 @@ func resourceBranchDeployDelete(d *schema.ResourceData, metaRaw interface{}) err

_, err = meta.Netlify.Operations.UpdateSite(params, meta.AuthInfo)

return err
if err != nil {
return err
}

time.Sleep(time.Second * 3)

return nil
}

func resourceBranchDeploy_getBranchAndBranches(d *schema.ResourceData, meta *Meta) (string, []string, error) {
Expand Down

0 comments on commit 446a5b2

Please sign in to comment.