Skip to content

Commit 317975f

Browse files
fix: more nil pointer fixes
1 parent dd3849c commit 317975f

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed

db-connector.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,9 @@ func SetWorkflowExecution(ctx context.Context, workflowExecution WorkflowExecuti
563563

564564
// This may get data from cache, hence we need to continuously set things in the database. Mainly as a precaution.
565565
newexec, err := GetWorkflowExecution(ctx, workflowExecution.ExecutionId)
566+
if err != nil {
567+
return fmt.Errorf("[ERROR] Failed to get new execution(%s): %s", workflowExecution.ExecutionId, err)
568+
}
566569

567570
HandleExecutionCacheIncrement(ctx, *newexec)
568571
if !dbSave && err == nil && (newexec.Status == "FINISHED" || newexec.Status == "ABORTED") {

health.go

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func RunOpsAppHealthCheck(apiKey string, orgId string) (AppHealth, error) {
261261
data.ExtensionProps.Extensions["editing"] = json.RawMessage(`false`)
262262
data.Info.Title = "Shuffle-Healthcheck"
263263
data.Info.Version = "2.0"
264-
data.Info.Description = fmt.Sprintf("Description for health check app with always some random string %s", randStr(10, "alphanum"))
264+
data.Info.Description = fmt.Sprintf("Description for health check app with always some random string")
265265

266266
// newOpenapiString := strings.Replace(openapiString, `"edaa73d40238ee60874a853dc3ccaa6f"`, `"`+id+`"`, 1)
267267
// newOpenapiString = strings.Replace(newOpenapiString, `"editing":true`, `"editing":false`, 1)
@@ -759,19 +759,7 @@ func RunOpsHealthCheck(resp http.ResponseWriter, request *http.Request) {
759759
platformHealth.OpensearchOps = <-opensearchHealthChannel
760760
}
761761

762-
// TODO: More testing for onprem health checks
763-
openapiAppHealthChannel := make(chan AppHealth)
764-
go func() {
765-
appHealth, err := RunOpsAppHealthCheck(apiKey, orgId)
766-
if err != nil {
767-
log.Printf("[ERROR] Failed running app health check: %s", err)
768-
}
769-
770-
appHealth.Result = ""
771-
openapiAppHealthChannel <- appHealth
772-
errorChannel <- err
773-
}()
774-
762+
775763
datastoreHealthChannel := make(chan DatastoreHealth)
776764
go func() {
777765
datastoreHealth, err := RunOpsDatastore(apiKey, orgId)
@@ -794,23 +782,35 @@ func RunOpsHealthCheck(resp http.ResponseWriter, request *http.Request) {
794782
errorChannel <- err
795783
}()
796784

797-
if project.Environment == "cloud" {
798-
// App upload via zip is not supported in self-hosted machine yet
799-
pythonAppHealthChannel := make(chan AppHealth)
800-
go func() {
801-
pythonAppHealth, err := RunOpsAppUpload(apiKey, orgId)
802-
if err != nil {
803-
log.Printf("[ERROR] Failed running python app health check: %s", err)
804-
}
805-
806-
pythonAppHealthChannel <- pythonAppHealth
807-
errorChannel <- err
808-
}()
785+
// TODO: More testing for onprem health checks
786+
openapiAppHealthChannel := make(chan AppHealth)
787+
go func() {
788+
appHealth, err := RunOpsAppHealthCheck(apiKey, orgId)
789+
if err != nil {
790+
log.Printf("[ERROR] Failed running app health check: %s", err)
791+
}
809792

793+
appHealth.Result = ""
794+
openapiAppHealthChannel <- appHealth
795+
errorChannel <- err
796+
}()
810797

811-
// Use channel for getting RunOpsWorkflow function results
812-
platformHealth.PythonApps = <-pythonAppHealthChannel
813-
}
798+
// if project.Environment == "cloud" {
799+
// // App upload via zip is not supported in self-hosted machine yet
800+
// pythonAppHealthChannel := make(chan AppHealth)
801+
// go func() {
802+
// pythonAppHealth, err := RunOpsAppUpload(apiKey, orgId)
803+
// if err != nil {
804+
// log.Printf("[ERROR] Failed running python app health check: %s", err)
805+
// }
806+
//
807+
// pythonAppHealthChannel <- pythonAppHealth
808+
// errorChannel <- err
809+
// }()
810+
//
811+
// // Use channel for getting RunOpsWorkflow function results
812+
// platformHealth.PythonApps = <-pythonAppHealthChannel
813+
// }
814814

815815
platformHealth.Datastore = <-datastoreHealthChannel
816816
platformHealth.FileOps = <-fileHealthChannel
@@ -2152,8 +2152,8 @@ func RunOpsFile(apikey, orgId string) (FileHealth, error) {
21522152
req.Header.Set("Content-Type", "application/json")
21532153

21542154
var fileRespStruct struct {
2155-
Success bool `json:success`
2156-
Id string `json:id`
2155+
Success bool `json:"success"`
2156+
Id string `json:"id"`
21572157
}
21582158

21592159
client := GetExternalClient(baseUrl)

structs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4367,7 +4367,7 @@ type HealthCheck struct {
43674367
Updated int64 `json:"updated"`
43684368
Apps AppHealth `json:"apps"`
43694369
Workflows WorkflowHealth `json:"workflows"`
4370-
PythonApps AppHealth `json:"python_apps"`
4370+
//PythonApps AppHealth `json:"python_apps"`
43714371
Datastore DatastoreHealth `json:"datastore"`
43724372
FileOps FileHealth `json:"fileops"`
43734373
OpensearchOps opensearchapi.ClusterHealthResp `json:"opensearch"`

0 commit comments

Comments
 (0)