Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Oct 4, 2024
2 parents 760b2f7 + df8c722 commit 0b8724c
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -14072,22 +14072,23 @@ func updateExecutionParent(ctx context.Context, executionParent, returnValue, pa
newResults = append(newResults, res)
}

if finishedSubflows == len(newResults) {
log.Printf("[DEBUG][%s] Finished workflow because status of all should be set to finished now", subflowExecutionId)
log.Printf("[INFO][%s] TOTAL FINISHED SUBFLOWS: %d/%d", subflowExecutionId, len(parentSubflowResult), len(newResults))

// Status is used to determine if the current subflow is finished

/*
foundResult.Status = "SUCCESS"
// Can it be if this and also status = "WAITING"?
if len(parentSubflowResult) == finishedSubflows && foundResult.Status != "SUCCESS" && foundResult.Status != "FAILURE" {
log.Printf("[INFO][%s] ALL THE SUBFLOW GOT THE RESULT BACK SO UPATING THE STATUS TO SUCCESS")
foundResult.Status = "SUCCESS"
if foundResult.CompletedAt == 0 {
foundResult.CompletedAt = time.Now().Unix() * 1000
}
ranUpdate = true

if result.CompletedAt == 0 {
result.CompletedAt = time.Now().Unix()*1000
}
*/
sendRequest = true
}

if ranUpdate {

// FIXME: Look into whether this sendRequest can be removed if we want reduce the amount of request
sendRequest = true
baseResultData, err := json.Marshal(newResults)
if err != nil {
Expand Down Expand Up @@ -14591,7 +14592,7 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut

// Verifying if the userinput should be sent properly or not
if actionResult.Action.Name == "run_userinput" && actionResult.Status != "SKIPPED" {
//log.Printf("\n\n[INFO] Inside userinput default return! Return data: %s", actionResult.Result)
// log.Printf("\n\n[INFO] Inside userinput default return! Return data: %s", actionResult.Result)
actionResult.Status = "WAITING"
actionResult.CompletedAt = time.Now().Unix() * 1000

Expand Down Expand Up @@ -15425,6 +15426,7 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut
}

updateParentRan := false

if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
//log.Printf("\nIN HERE WITH RESULTS %d vs %d\n", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
finished := true
Expand All @@ -15449,7 +15451,6 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut
//log.Printf("[INFO][%s] Execution in workflow %s finished (not subflow).", workflowExecution.ExecutionId, workflowExecution.Workflow.ID)
} else {
log.Printf("[INFO][%s] SubExecution of parentExecution %s in workflow %s finished (subflow).", workflowExecution.ExecutionId, workflowExecution.ExecutionParent, workflowExecution.Workflow.ID)

}

for actionIndex, action := range workflowExecution.Workflow.Actions {
Expand Down Expand Up @@ -15654,7 +15655,6 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut

// Setting to waiting, as it should be updated by child executions' fill-ins from their result when they finish
workflowExecution.Status = "EXECUTING"

amountFinished := 0
for _, subflowData := range subflowDataList {
if subflowData.ResultSet || len(subflowData.Result) > 0 {
Expand Down

0 comments on commit 0b8724c

Please sign in to comment.