Skip to content

Commit 0050123

Browse files
authored
Merge pull request #4835 from PetrusZ/fix/release_plan_timeout
fix: remove release plan timeout context
2 parents b58c4a9 + 8a0d6a2 commit 0050123

4 files changed

Lines changed: 10 additions & 24 deletions

File tree

pkg/microservice/aslan/core/release_plan/service/collaboration.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,7 @@ func broadcastReleasePlanCollaborationSnapshot(planID string) {
501501
}
502502

503503
func GetReleasePlanCollaborationSnapshot(planID string) (*ReleasePlanCollaborationSnapshot, error) {
504-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
505-
defer cancel()
504+
ctx := context.Background()
506505
plan, err := mongodb.NewReleasePlanColl().GetByID(ctx, planID)
507506
if err != nil {
508507
return nil, errors.Wrap(err, "get plan")

pkg/microservice/aslan/core/release_plan/service/release_plan.go

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ import (
5858
"github.com/koderover/zadig/v2/pkg/util"
5959
)
6060

61-
var (
62-
defaultTimeout = time.Second * 30
63-
)
64-
6561
func CreateReleasePlan(c *handler.Context, args *models.ReleasePlan) error {
6662
if args.Name == "" || args.ManagerID == "" {
6763
return errors.New("Required parameters are missing")
@@ -420,8 +416,7 @@ func UpdateReleasePlan(c *handler.Context, planID string, args *UpdateReleasePla
420416
}
421417
defer planLock.Unlock()
422418

423-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
424-
defer cancel()
419+
ctx := context.Background()
425420
plan, err := mongodb.NewReleasePlanColl().GetByID(ctx, planID)
426421
if err != nil {
427422
return errors.Wrap(err, "get plan")
@@ -614,8 +609,7 @@ func ExecuteReleaseJob(c *handler.Context, planID string, args *ExecuteReleaseJo
614609
approveLock.Lock()
615610
defer approveLock.Unlock()
616611

617-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
618-
defer cancel()
612+
ctx := context.Background()
619613
plan, err := mongodb.NewReleasePlanColl().GetByID(ctx, planID)
620614
if err != nil {
621615
return errors.Wrap(err, "get plan")
@@ -726,8 +720,7 @@ func RetryReleaseJob(c *handler.Context, planID string, args *RetryReleaseJobArg
726720
approveLock.Lock()
727721
defer approveLock.Unlock()
728722

729-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
730-
defer cancel()
723+
ctx := context.Background()
731724
plan, err := mongodb.NewReleasePlanColl().GetByID(ctx, planID)
732725
if err != nil {
733726
return errors.Wrap(err, "get plan")
@@ -1002,8 +995,7 @@ func SkipReleaseJob(c *handler.Context, planID string, args *SkipReleaseJobArgs,
1002995
approveLock.Lock()
1003996
defer approveLock.Unlock()
1004997

1005-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
1006-
defer cancel()
998+
ctx := context.Background()
1007999
plan, err := mongodb.NewReleasePlanColl().GetByID(ctx, planID)
10081000
if err != nil {
10091001
return errors.Wrap(err, "get plan")
@@ -1101,8 +1093,7 @@ func UpdateReleasePlanStatus(c *handler.Context, planID, targetStatus string, is
11011093
approveLock.Lock()
11021094
defer approveLock.Unlock()
11031095

1104-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
1105-
defer cancel()
1096+
ctx := context.Background()
11061097
plan, err := mongodb.NewReleasePlanColl().GetByID(ctx, planID)
11071098
if err != nil {
11081099
return errors.Wrap(err, "get plan")
@@ -1317,8 +1308,7 @@ func ApproveReleasePlan(c *handler.Context, planID string, req *ApproveRequest)
13171308
approveLock.Lock()
13181309
defer approveLock.Unlock()
13191310

1320-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
1321-
defer cancel()
1311+
ctx := context.Background()
13221312
plan, err := mongodb.NewReleasePlanColl().GetByID(ctx, planID)
13231313
if err != nil {
13241314
return errors.Wrap(err, "get plan")

pkg/microservice/aslan/core/release_plan/service/release_plan_copy.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ func CopyReleasePlan(c *handler.Context, planID string, args *CopyReleasePlanArg
3939
return errors.New("copy release plan args is nil")
4040
}
4141

42-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
43-
defer cancel()
42+
ctx := context.Background()
4443

4544
sourcePlan, err := mongodb.NewReleasePlanColl().GetByID(ctx, planID)
4645
if err != nil {

pkg/microservice/aslan/core/release_plan/service/watcher.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ func updatePlanWorkflowReleaseJob(plan *models.ReleasePlan, log *zap.SugaredLogg
7070
}
7171
defer releaseLock.Unlock()
7272

73-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
74-
defer cancel()
73+
ctx := context.Background()
7574
plan, err := mongodb.NewReleasePlanColl().GetByID(ctx, plan.ID.Hex())
7675
if err != nil {
7776
log.Errorf("get plan %s error: %v", plan.ID.Hex(), err)
@@ -188,8 +187,7 @@ func updatePlanApproval(plan *models.ReleasePlan) error {
188187
}
189188
defer approveLock.Unlock()
190189

191-
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
192-
defer cancel()
190+
ctx := context.Background()
193191
plan, err := mongodb.NewReleasePlanColl().GetByID(ctx, plan.ID.Hex())
194192
if err != nil {
195193
return errors.Errorf("get plan %s error: %v", plan.ID.Hex(), err)

0 commit comments

Comments
 (0)