From 20959cd6ccb72a2b52eec189b8450e46d00296e4 Mon Sep 17 00:00:00 2001 From: Toby Chui Date: Thu, 20 Feb 2025 20:25:20 +0800 Subject: [PATCH] Fixed #554 - Removed passive load balancer and default to active lb only --- src/mod/dynamicproxy/loadbalance/onlineStatus.go | 3 ++- src/mod/dynamicproxy/proxyRequestHandler.go | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mod/dynamicproxy/loadbalance/onlineStatus.go b/src/mod/dynamicproxy/loadbalance/onlineStatus.go index 6d2d591..a30217a 100644 --- a/src/mod/dynamicproxy/loadbalance/onlineStatus.go +++ b/src/mod/dynamicproxy/loadbalance/onlineStatus.go @@ -3,7 +3,6 @@ package loadbalance import ( "strconv" "strings" - "time" ) // Return if the target host is online @@ -36,6 +35,7 @@ func (m *RouteManager) NotifyHostOnlineState(upstreamIP string, isOnline bool) { // Set this host unreachable for a given amount of time defined in timeout // this shall be used in passive fallback. The uptime monitor should call to NotifyHostOnlineState() instead +/* func (m *RouteManager) NotifyHostUnreachableWithTimeout(upstreamIp string, timeout int64) { //if the upstream IP contains http or https, strip it upstreamIp = strings.TrimPrefix(upstreamIp, "http://") @@ -58,6 +58,7 @@ func (m *RouteManager) NotifyHostUnreachableWithTimeout(upstreamIp string, timeo m.NotifyHostOnlineState(upstreamIp, true) }() } +*/ // FilterOfflineOrigins return only online origins from a list of origins func (m *RouteManager) FilterOfflineOrigins(origins []*Upstream) []*Upstream { diff --git a/src/mod/dynamicproxy/proxyRequestHandler.go b/src/mod/dynamicproxy/proxyRequestHandler.go index 142972d..f4d8fea 100644 --- a/src/mod/dynamicproxy/proxyRequestHandler.go +++ b/src/mod/dynamicproxy/proxyRequestHandler.go @@ -3,7 +3,6 @@ package dynamicproxy import ( "context" "errors" - "fmt" "log" "net" "net/http" @@ -211,9 +210,6 @@ func (h *ProxyHandler) hostRequest(w http.ResponseWriter, r *http.Request, targe http.Error(w, "Request canceled", http.StatusRequestTimeout) h.Parent.logRequest(r, false, http.StatusRequestTimeout, "host-http", r.URL.Hostname()) } else { - //Notify the load balancer that the host is unreachable - fmt.Println(err.Error()) - h.Parent.loadBalancer.NotifyHostUnreachableWithTimeout(selectedUpstream.OriginIpOrDomain, PassiveLoadBalanceNotifyTimeout) http.ServeFile(w, r, "./web/rperror.html") h.Parent.logRequest(r, false, 521, "host-http", r.URL.Hostname()) }