Skip to content

Commit

Permalink
Add a small delay before starting proxies
Browse files Browse the repository at this point in the history
in order to ensure that backends are available.
  • Loading branch information
setaou committed Aug 31, 2023
1 parent efff179 commit 02d8bd3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ func main() {
backendUpdateSubscribers[id] = b.(backend.BackendUpdateSubscriber)
}

for _, c := range conf.ProxyList {
proxy.New(c, backendProviders, &wg, ctx)
}

// Plug update subscribers to providers
for _, bus := range backendUpdateSubscribers {
source := bus.GetUpdateSource()
Expand All @@ -123,6 +119,14 @@ func main() {

metrics.NewHTTPServer(conf.Metrics.Address, &wg, ctx)

// TODO: Replace that with a real retroaction from backend providers
time.Sleep(1 * time.Second) // Wait one second to ensure backends are available

// Start proxies
for _, c := range conf.ProxyList {
proxy.New(c, backendProviders, &wg, ctx)
}

// Termination signals
chan_signals := make(chan os.Signal, 1)
signal.Notify(chan_signals, syscall.SIGINT, syscall.SIGTERM)
Expand Down

0 comments on commit 02d8bd3

Please sign in to comment.