@@ -2054,6 +2054,7 @@ func GetWorkflowExecution(ctx context.Context, id string) (*WorkflowExecution, e
20542054 nameKey := "workflowexecution"
20552055 cacheKey := fmt .Sprintf ("%s_%s" , nameKey , id )
20562056
2057+ // Loads of cache management to ensure we have the latest version of the execution no matter what
20572058 workflowExecution := & WorkflowExecution {}
20582059 if project .CacheDb {
20592060 cache , err := GetCache (ctx , cacheKey )
@@ -2124,7 +2125,7 @@ func GetWorkflowExecution(ctx context.Context, id string) (*WorkflowExecution, e
21242125
21252126 wrapped := ExecWrapper {}
21262127 err = json .Unmarshal (respBody , & wrapped )
2127- if err != nil {
2128+ if err != nil && len ( wrapped . Source . ExecutionId ) == 0 {
21282129 return workflowExecution , err
21292130 }
21302131
@@ -4690,7 +4691,7 @@ func GetSession(ctx context.Context, thissession string) (*Session, error) {
46904691func DeleteKey (ctx context.Context , entity string , value string ) error {
46914692 // Non indexed User data
46924693 if entity == "workflowexecution" {
4693- log .Printf ("[WARNING] Deleting workflowexecution: %s" , value )
4694+ log .Printf ("[WARNING] DELETING workflowexecution: %s" , value )
46944695 }
46954696
46964697 DeleteCache (ctx , fmt .Sprintf ("%s_%s" , entity , value ))
@@ -10659,12 +10660,11 @@ func GetUnfinishedExecutions(ctx context.Context, workflowId string) ([]Workflow
1065910660 _ , err := it .Next (& innerWorkflow )
1066010661 if err != nil {
1066110662 // log.Printf("[WARNING] Error for %s: %s", cacheKey, err)
10662- break
10663- //if strings.Contains(fmt.Sprintf("%s", err), "cannot load field") {
10664- //} else {
10665- // //log.Printf("[WARNING] Workflow iterator issue: %s", err)
10666- // break
10667- //}
10663+ if strings .Contains (fmt .Sprintf ("%s" , err ), "cannot load field" ) {
10664+ } else {
10665+ //log.Printf("[WARNING] Workflow iterator issue: %s", err)
10666+ break
10667+ }
1066810668 }
1066910669
1067010670 executions = append (executions , innerWorkflow )
@@ -10807,7 +10807,7 @@ func GetAllWorkflowExecutionsV2(ctx context.Context, workflowId string, amount i
1080710807
1080810808 wrapped := ExecutionSearchWrapper {}
1080910809 err = json .Unmarshal (respBody , & wrapped )
10810- if err != nil {
10810+ if err != nil && len ( wrapped . Hits . Hits ) == 0 {
1081110811 return executions , cursor , err
1081210812 }
1081310813
@@ -11168,7 +11168,7 @@ func GetAllWorkflowExecutions(ctx context.Context, workflowId string, amount int
1116811168
1116911169 wrapped := ExecutionSearchWrapper {}
1117011170 err = json .Unmarshal (respBody , & wrapped )
11171- if err != nil {
11171+ if err != nil && len ( wrapped . Hits . Hits ) == 0 {
1117211172 return executions , err
1117311173 }
1117411174
@@ -11196,8 +11196,11 @@ func GetAllWorkflowExecutions(ctx context.Context, workflowId string, amount int
1119611196 innerWorkflow := WorkflowExecution {}
1119711197 _ , err := it .Next (& innerWorkflow )
1119811198 if err != nil {
11199- //log.Printf("[WARNING] Error getting workflow executions: %s", err)
11200- break
11199+ if strings .Contains (fmt .Sprintf ("%s" , err ), "cannot load field" ) {
11200+ } else {
11201+ log .Printf ("[WARNING] CreateValue iterator issue: %s" , err )
11202+ break
11203+ }
1120111204 }
1120211205
1120311206 executions = append (executions , innerWorkflow )
@@ -13397,7 +13400,7 @@ func GetWorkflowRunsBySearch(ctx context.Context, orgId string, search WorkflowS
1339713400
1339813401 wrapped := ExecutionSearchWrapper {}
1339913402 err = json .Unmarshal (respBody , & wrapped )
13400- if err != nil {
13403+ if err != nil && len ( wrapped . Hits . Hits ) == 0 {
1340113404 return executions , "" , err
1340213405 }
1340313406
0 commit comments