Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion go/porcelain/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func (n *Netlify) waitForState(ctx context.Context, d *models.Deploy, timeout ti
context.GetLogger(ctx).WithFields(logrus.Fields{
"deploy_id": d.ID,
"state": resp.Payload.State,
}).Debug("Waiting until deploy ready")
}).Debugf("Waiting until deploy state in %s", states)

for _, state := range states {
if resp.Payload.State == state {
Expand All @@ -331,6 +331,7 @@ func (n *Netlify) waitForState(ctx context.Context, d *models.Deploy, timeout ti
return d, nil
}

// WaitUntilDeployReady blocks until the deploy is in the "prepared" or "ready" state.
func (n *Netlify) WaitUntilDeployReady(ctx context.Context, d *models.Deploy, timeout time.Duration) (*models.Deploy, error) {
if timeout <= 0 {
timeout = preProcessingTimeout
Expand All @@ -339,6 +340,15 @@ func (n *Netlify) WaitUntilDeployReady(ctx context.Context, d *models.Deploy, ti
return n.waitForState(ctx, d, timeout, "prepared", "ready")
}

// WaitUntilDeployLive blocks until the deploy is in the or "ready" state. At this point, the deploy is ready to recieve traffic.
func (n *Netlify) WaitUntilDeployLive(ctx context.Context, d *models.Deploy, timeout time.Duration) (*models.Deploy, error) {
if timeout <= 0 {
timeout = preProcessingTimeout
}

return n.waitForState(ctx, d, timeout, "ready")
}

func (n *Netlify) uploadFiles(ctx context.Context, d *models.Deploy, files *deployFiles, observer DeployObserver, t uploadType, timeout time.Duration) error {
sharedErr := &uploadError{err: nil, mutex: &sync.Mutex{}}
sem := make(chan int, n.uploadLimit)
Expand Down