Skip to content

Commit 81b4ae1

Browse files
committed
Merge branch 'main' of github.com:Shuffle/Shuffle-shared
2 parents 692cfab + 01fc390 commit 81b4ae1

File tree

4 files changed

+1163
-1055
lines changed

4 files changed

+1163
-1055
lines changed

db-connector.go

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,11 +1698,15 @@ func Fixexecution(ctx context.Context, workflowExecution WorkflowExecution) (Wor
16981698
dbsave := false
16991699
workflowExecution.Workflow.Image = ""
17001700

1701-
if workflowExecution.Status != "EXECUTING" {
1702-
validation, err := GetExecutionValidation(ctx, workflowExecution.ExecutionId)
1703-
if err == nil {
1704-
workflowExecution.Workflow.Validation = validation
1701+
// FIXME: May be a problem here with setting it at all times~
1702+
//if workflowExecution.Status != "EXECUTING" {
1703+
validation, err := GetExecutionValidation(ctx, workflowExecution.ExecutionId)
1704+
if err == nil {
1705+
if workflowExecution.NotificationsCreated > 0 {
1706+
validation.NotificationsCreated = workflowExecution.NotificationsCreated
17051707
}
1708+
1709+
workflowExecution.Workflow.Validation = validation
17061710
}
17071711

17081712
// Make sure to not having missing items in the execution
@@ -3235,6 +3239,15 @@ func GetWorkflow(ctx context.Context, id string) (*Workflow, error) {
32353239
cacheData := []byte(cache.([]uint8))
32363240
err = json.Unmarshal(cacheData, &workflow)
32373241
if err == nil && workflow.ID != "" {
3242+
validationData, err := GetCache(ctx, fmt.Sprintf("validation_workflow_%s", workflow.ID))
3243+
if err == nil {
3244+
cacheData := []byte(validationData.([]uint8))
3245+
err = json.Unmarshal(cacheData, &workflow.Validation)
3246+
if err != nil {
3247+
log.Printf("[ERROR] Failed unmarshalling cache data for execution status (4): %s", err)
3248+
}
3249+
}
3250+
32383251
// Somehow this can happen. Reverting to LATEST revision
32393252
if len(workflow.Actions) > 0 && len(workflow.Triggers) == 0 {
32403253
revisions, err := ListWorkflowRevisions(ctx, workflow.ID, 2)
@@ -3259,6 +3272,16 @@ func GetWorkflow(ctx context.Context, id string) (*Workflow, error) {
32593272
}
32603273
}
32613274

3275+
healthWorkflow, _, err := GetStaticWorkflowHealth(ctx, *workflow)
3276+
if err != nil {
3277+
if !strings.Contains(err.Error(), "Org ID not set") {
3278+
log.Printf("[ERROR] Failed getting static workflow health for workflow %s: %s (2)", workflow.ID, err)
3279+
}
3280+
3281+
} else {
3282+
workflow = &healthWorkflow
3283+
}
3284+
32623285
return workflow, nil
32633286
}
32643287
} else {
@@ -3352,6 +3375,16 @@ func GetWorkflow(ctx context.Context, id string) (*Workflow, error) {
33523375

33533376
newWorkflow := FixWorkflowPosition(ctx, *workflow)
33543377
workflow = &newWorkflow
3378+
3379+
healthWorkflow, _, err := GetStaticWorkflowHealth(ctx, *workflow)
3380+
if err != nil {
3381+
if !strings.Contains(err.Error(), "Org ID not set") {
3382+
log.Printf("[ERROR] Failed getting static workflow health for workflow %s: %s (2)", workflow.ID, err)
3383+
}
3384+
} else {
3385+
workflow = &healthWorkflow
3386+
}
3387+
33553388
if project.CacheDb && workflow.ID != "" {
33563389
//log.Printf("[DEBUG] Setting cache for workflow %s", cacheKey)
33573390
data, err := json.Marshal(workflow)

0 commit comments

Comments
 (0)