Skip to content

Commit

Permalink
fix(api): load only one node hook by its uuid (#4666)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj committed Oct 14, 2019
1 parent 1f71d22 commit 1766f58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion engine/api/workflow/dao_data_hook.go
Expand Up @@ -28,7 +28,8 @@ func CountHooksByApplication(db gorp.SqlExecutor, appID int64) (int64, error) {
func LoadHookByUUID(db gorp.SqlExecutor, uuid string) (sdk.NodeHook, error) {
var hook sdk.NodeHook
var res dbNodeHookData
if err := db.SelectOne(&res, "select * from w_node_hook where uuid = $1", uuid); err != nil {
// TODO: delete ORDER BY and LIMIT 1 when the bug of duplicate uuid is fixed
if err := db.SelectOne(&res, "select * from w_node_hook where uuid = $1 ORDER BY node_id DESC LIMIT 1", uuid); err != nil {
if err == sql.ErrNoRows {
return hook, sdk.WithStack(sdk.ErrNotFound)
}
Expand Down
3 changes: 3 additions & 0 deletions sdk/workflow_conditions.go
Expand Up @@ -34,6 +34,9 @@ var (

//WorkflowCheckConditions checks conditions given a list of parameters
func WorkflowCheckConditions(conditions []WorkflowNodeCondition, params []Parameter) (bool, error) {
if len(conditions) == 0 {
return true, nil
}
mapParams := ParametersToMap(params)
for k, v := range mapParams {
var err error
Expand Down

0 comments on commit 1766f58

Please sign in to comment.