From 1285c1f36ce55aad22696d698d0e39e1b316800d Mon Sep 17 00:00:00 2001 From: Frikky Date: Sun, 22 Oct 2023 23:10:35 +0200 Subject: [PATCH] Minor localhost/backend check for worker url --- functions/onprem/orborus/orborus.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index aa102a45..1685f350 100755 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -1818,14 +1818,19 @@ func sendWorkerRequest(workflowExecution shuffle.ExecutionRequest) error { } streamUrl := fmt.Sprintf("http://shuffle-workers:33333/api/v1/execute") - if (containerId == "" || containerId == "shuffle-orborus") && !strings.Contains(workerServerUrl, "shuffle-backend") { + if containerId == "" || containerId == "shuffle-orborus" { streamUrl = fmt.Sprintf("%s:33333/api/v1/execute", parsedBaseurl) } - if len(workerServerUrl) > 0 && !strings.Contains(workerServerUrl, "shuffle-backend") { + if len(workerServerUrl) > 0 { streamUrl = fmt.Sprintf("%s:33333/api/v1/execute", workerServerUrl) } + if strings.Contains(streamUrl, "localhost") || strings.Contains(streamUrl, "shuffle-backend") { + log.Printf("[INFO] Using default worker server url as previous is invalid: %s", streamUrl) + streamUrl = fmt.Sprintf("http://shuffle-workers:33333/api/v1/execute") + } + client := &http.Client{} req, err := http.NewRequest( "POST",