Minor fixes for testing Singul locally

This commit is contained in:
Frikky
2025-05-20 01:07:16 +02:00
parent 3a8cbbe2e4
commit c2c4a9c323
3 changed files with 34 additions and 18 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ toolchain go1.23.8
//replace github.com/frikky/schemaless => ../../../schemaless
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
require (
cloud.google.com/go/datastore v1.20.0
@@ -22,7 +22,7 @@ require (
github.com/gorilla/mux v1.8.1
github.com/h2non/filetype v1.1.3
github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.8.58
github.com/shuffle/shuffle-shared v0.8.60
golang.org/x/crypto v0.37.0
google.golang.org/api v0.228.0
google.golang.org/grpc v1.71.1
+12 -7
View File
@@ -1905,8 +1905,8 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) {
err = shuffle.SetSchedule(ctx, newSchedule)
if err != nil {
log.Printf("Failed setting cloud schedule: %s", err)
resp.WriteHeader(401)
log.Printf("[ERROR] Failed setting cloud schedule: %s", err)
resp.WriteHeader(400)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err)))
return
}
@@ -1941,17 +1941,22 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) {
// FIXME - real error message lol
if err != nil {
log.Printf("Failed creating schedule: %s", err)
resp.WriteHeader(401)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Invalid argument. Try cron */15 * * * *"}`)))
log.Printf("[ERROR] Failed creating schedule: %s", err)
resp.WriteHeader(400)
if schedule.Environment == "cloud" {
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Invalid argument. For cloud schedules, try cron */15 * * * *"}`)))
} else {
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Invalid argument. For onprem schedules, try 60 for 60 seconds"}`)))
}
return
}
//workflow.Schedules = append(workflow.Schedules, schedule)
err = shuffle.SetWorkflow(ctx, *workflow, workflow.ID)
if err != nil {
log.Printf("Failed setting workflow for schedule: %s", err)
resp.WriteHeader(401)
log.Printf("[ERROR] Failed setting workflow for schedule: %s", err)
resp.WriteHeader(400)
resp.Write([]byte(`{"success": false}`))
return
}