Skip to content

Commit 3a488f4

Browse files
committed
2 parents 4de9074 + 60e01b6 commit 3a488f4

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

db-connector.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8058,9 +8058,11 @@ func ListWorkflowRevisions(ctx context.Context, originalId string, amount int) (
80588058
} else {
80598059
query := datastore.NewQuery(nameKey).Filter("id =", originalId)
80608060
// if project.Environment == "cloud" {
8061-
query = query.Order("-edited").Limit(amount)
8061+
query = query.Order("-edited")
80628062
// }
80638063

8064+
iterCount := 0
8065+
80648066
cursorStr := ""
80658067
for {
80668068
it := project.Dbclient.Run(ctx, query)
@@ -8076,7 +8078,15 @@ func ListWorkflowRevisions(ctx context.Context, originalId string, amount int) (
80768078
}
80778079
}
80788080

8081+
iterCount++;
80798082
workflows = append(workflows, innerWorkflow)
8083+
if iterCount >= amount {
8084+
break
8085+
}
8086+
}
8087+
8088+
if iterCount >= amount {
8089+
break
80808090
}
80818091

80828092
if err != iterator.Done {

shared.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6964,8 +6964,6 @@ func diffWorkflows(oldWorkflow Workflow, parentWorkflow Workflow, update bool) {
69646964

69656965
action.Parameters = finalParamters
69666966

6967-
// the updated action is given the right authentication ID every time.
6968-
log.Printf("[DEBUG] Authentication ID that's literally being passed in: %s", action.AuthenticationId)
69696967
childWorkflow.Actions[index] = action
69706968
break
69716969
}
@@ -28945,8 +28943,19 @@ func GetWorkflowRevisions(resp http.ResponseWriter, request *http.Request) {
2894528943
}
2894628944
}
2894728945

28946+
revisionCount := 50
28947+
if request.URL.Query().Get("count") != "" {
28948+
revisionCount, err = strconv.Atoi(request.URL.Query().Get("count"))
28949+
if err != nil {
28950+
log.Printf("[WARNING] Failed converting count to int: %s", err)
28951+
resp.WriteHeader(400)
28952+
resp.Write([]byte(`{"success": false, "reason": "Failed converting count to int"}`))
28953+
return
28954+
}
28955+
}
28956+
2894828957
// Access is granted -> get revisions
28949-
revisions, err := ListWorkflowRevisions(ctx, workflow.ID, 50)
28958+
revisions, err := ListWorkflowRevisions(ctx, workflow.ID, revisionCount)
2895028959
if err != nil {
2895128960
log.Printf("[WARNING] Failed getting revisions for workflow %s: %s", workflow.ID, err)
2895228961
resp.WriteHeader(400)

0 commit comments

Comments
 (0)