Skip to content

Commit 2507ebc

Browse files
committed
Minor debug log add
1 parent 4957d02 commit 2507ebc

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

db-connector.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,9 @@ func GetWorkflowExecution(ctx context.Context, id string) (*WorkflowExecution, e
889889

890890
return workflowExecution, nil
891891
} else {
892-
//log.Printf("[WARNING] Failed getting workflowexecution: %s", err)
892+
if debug {
893+
log.Printf("[DEBUG] Failed mapping workflowexecution cache for '%s': %s", id, err)
894+
}
893895
}
894896
} else {
895897
}
@@ -899,6 +901,7 @@ func GetWorkflowExecution(ctx context.Context, id string) (*WorkflowExecution, e
899901
return workflowExecution, errors.New("ExecutionId doesn't exist in cache")
900902
}
901903

904+
var getErr error = nil
902905
if project.DbType == "opensearch" {
903906
resp, err := project.Es.Document.Get(ctx, opensearchapi.DocumentGetReq{
904907
Index: strings.ToLower(GetESIndexPrefix(nameKey)),
@@ -944,11 +947,11 @@ func GetWorkflowExecution(ctx context.Context, id string) (*WorkflowExecution, e
944947
}
945948
} else {
946949
key := datastore.NameKey(nameKey, strings.ToLower(id), nil)
947-
if err := project.Dbclient.Get(ctx, key, workflowExecution); err != nil {
948-
if strings.Contains(err.Error(), `cannot load field`) {
949-
err = nil
950+
if getErr = project.Dbclient.Get(ctx, key, workflowExecution); getErr != nil {
951+
if strings.Contains(getErr.Error(), `cannot load field`) {
952+
getErr = nil
950953
} else {
951-
return workflowExecution, err
954+
//return workflowExecution, err
952955
}
953956
}
954957

@@ -959,6 +962,7 @@ func GetWorkflowExecution(ctx context.Context, id string) (*WorkflowExecution, e
959962
Result: workflowExecution.ExecutionArgument,
960963
Action: Action{ID: "execution_argument"},
961964
}
965+
962966
newValue, err := getExecutionFileValue(ctx, *workflowExecution, *baseArgument)
963967
if err != nil {
964968
log.Printf("[DEBUG] Failed to parse in execution file value for exec argument: %s (4)", err)
@@ -996,7 +1000,7 @@ func GetWorkflowExecution(ctx context.Context, id string) (*WorkflowExecution, e
9961000
newexecution, err := json.Marshal(workflowExecution)
9971001
if err != nil {
9981002
log.Printf("[WARNING] Failed marshalling execution: %s", err)
999-
return workflowExecution, nil
1003+
return workflowExecution, getErr
10001004
}
10011005

10021006
err = SetCache(ctx, id, newexecution, 30)
@@ -1005,7 +1009,7 @@ func GetWorkflowExecution(ctx context.Context, id string) (*WorkflowExecution, e
10051009
}
10061010
}
10071011

1008-
return workflowExecution, nil
1012+
return workflowExecution, getErr
10091013
}
10101014

10111015
func getWorkflowExecutionByAliasSearch(ctx context.Context, aliasName, id string) (*WorkflowExecution, error) {

0 commit comments

Comments
 (0)