This is an automated email from the ASF dual-hosted git repository.

lynwee pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 4273d17ef fix(webhook): remove duplicated database locks (#6309)
4273d17ef is described below

commit 4273d17ef2c1ee8f55fab8bb158983c2e5247397
Author: Lynwee <[email protected]>
AuthorDate: Tue Oct 24 11:50:39 2023 +0800

    fix(webhook): remove duplicated database locks (#6309)
---
 backend/plugins/webhook/api/deployments.go | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/backend/plugins/webhook/api/deployments.go 
b/backend/plugins/webhook/api/deployments.go
index effbbaa28..1c074578e 100644
--- a/backend/plugins/webhook/api/deployments.go
+++ b/backend/plugins/webhook/api/deployments.go
@@ -20,7 +20,6 @@ package api
 import (
        "crypto/md5"
        "fmt"
-       "github.com/apache/incubator-devlake/core/dal"
        "github.com/apache/incubator-devlake/helpers/dbhelper"
        "net/http"
        "time"
@@ -84,13 +83,8 @@ func PostDeploymentCicdTask(input *plugin.ApiResourceInput) 
(*plugin.ApiResource
                return nil, errors.BadInput.Wrap(vld.Struct(request), `input 
json error`)
        }
        txHelper := dbhelper.NewTxHelper(basicRes, &err)
-       defer txHelper.End()
        tx := txHelper.Begin()
-       err = txHelper.LockTablesTimeout(2*time.Second, dal.LockTables{{Table: 
"cicd_deployment_commits"}, {Table: "cicd_deployments"}})
-       if err != nil {
-               err = errors.Conflict.Wrap(err, "This CI/CD deployment cannot 
be post due to a table lock error. There might be running pipeline(s) or other 
operations in progress.")
-               return nil, err
-       }
+       defer txHelper.End()
        urlHash16 := fmt.Sprintf("%x", md5.Sum([]byte(request.RepoUrl)))[:16]
        scopeId := fmt.Sprintf("%s:%d", "webhook", connection.ID)
        deploymentCommitId := fmt.Sprintf("%s:%d:%s:%s", "webhook", 
connection.ID, urlHash16, request.CommitSha)

Reply via email to