Skip to content

Commit

Permalink
Add in timeout for branch promotion.
Browse files Browse the repository at this point in the history
  • Loading branch information
iheanyi committed Sep 16, 2021
1 parent a86ef0e commit 35c8ea4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/cmd/branch/promote.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package branch

import (
"context"
"fmt"
"time"

Expand Down Expand Up @@ -85,8 +86,10 @@ func PromoteCmd(ch *cmdutil.Helper) *cobra.Command {
Branch: branch,
}

ctx, cancel := context.WithTimeout(cmd.Context(), 30*time.Second)
defer cancel()
for promotionRequest.State == "pending" {
promotionRequest, err = client.DatabaseBranches.GetPromotionRequest(cmd.Context(), getReq)
promotionRequest, err = client.DatabaseBranches.GetPromotionRequest(ctx, getReq)
if err != nil {
switch cmdutil.ErrCode(err) {
case ps.ErrNotFound:
Expand Down

0 comments on commit 35c8ea4

Please sign in to comment.