Skip to content

Commit

Permalink
Cancel prev state health check on config update (merge from v3)
Browse files Browse the repository at this point in the history
  • Loading branch information
horkhe committed Oct 9, 2023
1 parent a48500e commit 580b1cf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/server/routerfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type RouterFactory struct {

chainBuilder *middleware.ChainBuilder
tlsManager *tls.Manager

cancelPrevState func()
}

// NewRouterFactory creates a new RouterFactory.
Expand Down Expand Up @@ -65,7 +67,12 @@ func NewRouterFactory(staticConfiguration static.Configuration, managerFactory *

// CreateRouters creates new TCPRouters and UDPRouters.
func (f *RouterFactory) CreateRouters(rtConf *runtime.Configuration) (map[string]*tcprouter.Router, map[string]udptypes.Handler) {
ctx := context.Background()
if f.cancelPrevState != nil {
f.cancelPrevState()
}

var ctx context.Context
ctx, f.cancelPrevState = context.WithCancel(context.Background())

// HTTP
serviceManager := f.managerFactory.Build(rtConf)
Expand Down

0 comments on commit 580b1cf

Please sign in to comment.