Skip to content

Commit 02d0daf

Browse files
committed
enhance(upstream): proxy target parsing from multiple configs
1 parent 44246c9 commit 02d0daf

File tree

7 files changed

+602
-40
lines changed

7 files changed

+602
-40
lines changed

api/analytic/nodes.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ func GetNodeStat(c *gin.Context) {
6565
NodeInfo: nodeInfo,
6666
NodeStat: stat,
6767
}
68-
69-
logger.Debugf("Sending complete node info including version: %s", ver.Version)
7068
}
7169
} else {
7270
// Send only stat information for performance

internal/cron/upstream_availability.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cron
33
import (
44
"time"
55

6-
apiUpstream "github.com/0xJacky/Nginx-UI/api/upstream"
76
"github.com/0xJacky/Nginx-UI/internal/upstream"
87
"github.com/go-co-op/gocron/v2"
98
"github.com/uozi-tech/cosy/logger"
@@ -41,13 +40,6 @@ func executeUpstreamAvailabilityTest() {
4140
return
4241
}
4342

44-
// Check if we should skip this test due to active WebSocket connections
45-
// (WebSocket connections trigger more frequent checks)
46-
if hasActiveWebSocketConnections() {
47-
logger.Debug("Skipping scheduled test due to active WebSocket connections")
48-
return
49-
}
50-
5143
start := time.Now()
5244
logger.Debug("Starting scheduled upstream availability test for", targetCount, "targets")
5345

@@ -57,11 +49,6 @@ func executeUpstreamAvailabilityTest() {
5749
logger.Debug("Upstream availability test completed in", duration)
5850
}
5951

60-
// hasActiveWebSocketConnections checks if there are active WebSocket connections
61-
func hasActiveWebSocketConnections() bool {
62-
return apiUpstream.HasActiveWebSocketConnections()
63-
}
64-
6552
// RestartUpstreamAvailabilityJob restarts the upstream availability job
6653
func RestartUpstreamAvailabilityJob() error {
6754
logger.Info("Restarting upstream availability job...")

internal/site/index.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,13 @@ func scanForSite(configPath string, content []byte) error {
220220
siteIndex.Urls = append(siteIndex.Urls, url)
221221
}
222222

223+
// Ensure upstream service has the latest global upstream definitions
224+
upstreamService := upstream.GetUpstreamService()
225+
if upstreamService != nil {
226+
// Force a rescan of all upstream definitions to ensure we have the latest global state
227+
upstreamService.RefreshGlobalUpstreams()
228+
}
229+
223230
// Parse proxy targets from the configuration content
224231
siteIndex.ProxyTargets = upstream.ParseProxyTargetsFromRawContent(string(content))
225232

internal/stream/index.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ func scanForStream(configPath string, content []byte) error {
4141
ProxyTargets: []upstream.ProxyTarget{},
4242
}
4343

44+
// Ensure upstream service has the latest global upstream definitions
45+
upstreamService := upstream.GetUpstreamService()
46+
if upstreamService != nil {
47+
// Force a rescan of all upstream definitions to ensure we have the latest global state
48+
upstreamService.RefreshGlobalUpstreams()
49+
}
50+
4451
// Parse proxy targets from the configuration content
4552
streamIndex.ProxyTargets = upstream.ParseProxyTargetsFromRawContent(string(content))
4653
// Only store if we found proxy targets

0 commit comments

Comments
 (0)