Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check if health check already exist in the queue #156

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yashsinghcodes
Copy link
Member

No description provided.

Copy link
Member

@frikky frikky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

health.go Outdated
@@ -429,6 +429,51 @@ func deleteJunkOpsWorkflow(ctx context.Context, workflowHealth WorkflowHealth) e
return nil
}

func checkQueueForHealthRun(ctx context.Context) error{
baseUrl := "https://shuffler.io"
if os.Getenv("SHUFFLE_CLOUDRUN_URL") != "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just always check BASE_URL > CLOUDRUN_URL, as CLOUDRUN_URL is the override we use everywhere

health.go Outdated
baseUrl = os.Getenv("SHUFFLE_CLOUDRUN_URL")
}

if project.Environment == "onprem" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be wrong, so instead of == "onprem" do != "cloud"

health.go Outdated


client := GetExternalClient(baseUrl)
fullUrl := fmt.Sprintf("%s/api/v1/workflows/queue", baseUrl)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you read this directly from the database? Using the API seems silly lol.

@@ -565,6 +610,41 @@ func RunOpsHealthCheck(resp http.ResponseWriter, request *http.Request) {
}
} else {
// FIXME: Add a check for if it's been <interval> length at least between runs. This is 15 minutes by default.
err := checkQueueForHealthRun(ctx)
if err != nil {
log.Printf("[ERROR] Failed running health check (4): %s", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this then fail out? Why are we not handling the error?

@yashsinghcodes
Copy link
Member Author

ready for round 2 of review @frikky :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants