Skip to content

Commit

Permalink
refactor: adjust the sliding timer of Gateway (#576)
Browse files Browse the repository at this point in the history
refactor: adjust the sliding timer

Signed-off-by: Lin Yang <[email protected]>
  • Loading branch information
reaver-flomesh authored Dec 26, 2024
1 parent 8514ebe commit 66c38c3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/gateway/repo/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func (s *Server) BroadcastListener() {
gatewayUpdateChan := gatewayUpdatePubSub.Sub(announcements.GatewayUpdate.String())
defer s.msgBroker.Unsub(gatewayUpdatePubSub, gatewayUpdateChan)

// Wait for two informer synchronization periods
slidingTimer := time.NewTimer(time.Second * 20)
// Wait for one informer synchronization periods
slidingTimer := time.NewTimer(time.Second * 10)
defer slidingTimer.Stop()

reconfirm := true
Expand All @@ -23,11 +23,10 @@ func (s *Server) BroadcastListener() {
select {
case <-gatewayUpdateChan:
// Wait for an informer synchronization period
slidingTimer.Reset(time.Second * 5)
slidingTimer.Reset(time.Second * 10)
// Avoid data omission
reconfirm = true
case <-slidingTimer.C:
//metricsstore.DefaultMetricsStore.ProxyConnectCount.Set(float64(len(proxies)))
newJob := func() *GatewayConfGeneratorJob {
return &GatewayConfGeneratorJob{
processor: s.processor,
Expand Down

0 comments on commit 66c38c3

Please sign in to comment.