BUG: Fixed resource overload when getting workflows
This commit is contained in:
@@ -4455,7 +4455,7 @@ func handleGetallHooks(resp http.ResponseWriter, request *http.Request) {
|
|||||||
var allhooks []Hook
|
var allhooks []Hook
|
||||||
_, err = dbclient.GetAll(ctx, q, &allhooks)
|
_, err = dbclient.GetAll(ctx, q, &allhooks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed getting workflows for user %s: %s", user.Username, err)
|
log.Printf("Failed getting hooks for user %s: %s", user.Username, err)
|
||||||
resp.WriteHeader(401)
|
resp.WriteHeader(401)
|
||||||
resp.Write([]byte(`{"success": false}`))
|
resp.Write([]byte(`{"success": false}`))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1421,10 +1421,21 @@ func getWorkflows(resp http.ResponseWriter, request *http.Request) {
|
|||||||
var workflows []Workflow
|
var workflows []Workflow
|
||||||
_, err = dbclient.GetAll(ctx, q, &workflows)
|
_, err = dbclient.GetAll(ctx, q, &workflows)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed getting workflows for user %s: %s", user.Username, err)
|
if strings.Contains(fmt.Sprintf("%s", err), "ResourceExhausted") {
|
||||||
resp.WriteHeader(401)
|
q = q.Limit(35)
|
||||||
resp.Write([]byte(`{"success": false}`))
|
_, err = dbclient.GetAll(ctx, q, &workflows)
|
||||||
return
|
if err != nil {
|
||||||
|
log.Printf("Failed getting workflows for user %s: %s", user.Username, err)
|
||||||
|
resp.WriteHeader(401)
|
||||||
|
resp.Write([]byte(`{"success": false}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Printf("Failed getting workflows for user %s: %s", user.Username, err)
|
||||||
|
resp.WriteHeader(401)
|
||||||
|
resp.Write([]byte(`{"success": false}`))
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(workflows) == 0 {
|
if len(workflows) == 0 {
|
||||||
@@ -5401,6 +5412,8 @@ func iterateWorkflowGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra
|
|||||||
workflow.Org = append(workflow.Org, Org{
|
workflow.Org = append(workflow.Org, Org{
|
||||||
Id: orgId,
|
Id: orgId,
|
||||||
})
|
})
|
||||||
|
workflow.IsValid = false
|
||||||
|
workflow.Errors = []string{"Imported, not locally saved. Save before using."}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Find existing similar ones
|
// Find existing similar ones
|
||||||
|
|||||||
Reference in New Issue
Block a user