Skip to content

Commit

Permalink
Moved apps to run with milliseconds instead of seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Nov 30, 2023
1 parent 9bacd32 commit 630a4f3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app_upload/stitcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,8 +847,8 @@ func main() {
bucketName = os.Args[5]
}

appname := "http"
appversion := "1.3.0"
appname := "shuffle-tools"
appversion := "1.2.0"
err := deployConfigToBackend(appfolder, appname, appversion)
if err != nil {
log.Printf("[WARNING] Failed uploading config: %s", err)
Expand Down
6 changes: 6 additions & 0 deletions db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,11 +680,17 @@ func GetCache(ctx context.Context, name string) (interface{}, error) {
}

func SetCache(ctx context.Context, name string, data []byte, expiration int32) error {
// Set cache verbose
//if strings.Contains(name, "execution") || strings.Contains(name, "action") && len(data) > 1 {
// fmt.Printf("\n\n[DEBUG] Setting cache '%s', length %d\n\n", name, len(data))
//}

if len(name) == 0 {
log.Printf("[WARNING] Key '%s' is empty with value length %d and expiration %d. Skipping cache.", name, len(data), expiration)
return nil
}


// Maxsize ish~
name = strings.Replace(name, " ", "_", -1)

Expand Down
17 changes: 13 additions & 4 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -10091,6 +10091,15 @@ func FixActionResultOutput(actionResult ActionResult) ActionResult {
actionResult.Result = `{"success": false, "reason": "This App requires authentication with Oauth2. Make sure to authenticate it first."}`
}

// Check length of result timestamp
if len(strconv.FormatInt(actionResult.StartedAt, 10)) == 10 {
actionResult.StartedAt = actionResult.StartedAt*1000
}

if len(strconv.FormatInt(actionResult.CompletedAt, 10)) == 10 {
actionResult.CompletedAt = actionResult.CompletedAt*1000
}

return actionResult
}

Expand Down Expand Up @@ -14854,7 +14863,7 @@ func PrepareWorkflowExecution(ctx context.Context, workflow Workflow, request *h
}

// This one doesn't really matter.
log.Printf("[INFO][%s] Running POST execution with body of length %d for workflow %s", workflowExecution.ExecutionId, len(string(body)), workflowExecution.Workflow.ID)
//log.Printf("[INFO][%s] Running POST execution with body of length %d for workflow %s", workflowExecution.ExecutionId, len(string(body)), workflowExecution.Workflow.ID)

if len(body) >= 4 {
if body[0] == 34 && body[len(body)-1] == 34 {
Expand Down Expand Up @@ -15007,7 +15016,7 @@ func PrepareWorkflowExecution(ctx context.Context, workflow Workflow, request *h
log.Printf("[DEBUG][%s] Body: %s", workflowExecution.ExecutionId, string(body))
} else {
// Here for debug purposes
log.Printf("[DEBUG][%s] Body len: %d", workflowExecution.ExecutionId, len(string(body)))
//log.Printf("[DEBUG][%s] Body len: %d", workflowExecution.ExecutionId, len(string(body)))
}

var execution ExecutionRequest
Expand Down Expand Up @@ -15041,7 +15050,7 @@ func PrepareWorkflowExecution(ctx context.Context, workflow Workflow, request *h

//log.Printf("Execution data: %s", execution)
if len(execution.Start) == 36 && len(workflow.Actions) > 0 {
log.Printf("[INFO][%s] Should start execution on node %s", execution.ExecutionId, execution.Start)
//log.Printf("[INFO][%s] Should start execution on node %s", execution.ExecutionId, execution.Start)
workflowExecution.Start = execution.Start

found := false
Expand Down Expand Up @@ -15400,7 +15409,7 @@ func PrepareWorkflowExecution(ctx context.Context, workflow Workflow, request *h
workflowExecution.ExecutionSource = "default"
}

log.Printf("[INFO][%s] Execution source is '%s' in workflow %s. Organization: %s", workflowExecution.ExecutionSource, workflowExecution.ExecutionId, workflowExecution.Workflow.ID, workflowExecution.OrgId)
//log.Printf("[INFO][%s] Execution source is '%s' in workflow %s. Organization: %s", workflowExecution.ExecutionSource, workflowExecution.ExecutionId, workflowExecution.Workflow.ID, workflowExecution.OrgId)

workflowExecution.ExecutionVariables = workflow.ExecutionVariables
if len(workflowExecution.Start) == 0 && len(workflowExecution.Workflow.Start) > 0 {
Expand Down

0 comments on commit 630a4f3

Please sign in to comment.