Skip to content

Commit

Permalink
Merge pull request #2 from mailgun/maxim/develop
Browse files Browse the repository at this point in the history
Cancel prev state health check on config update (merge from v3)
  • Loading branch information
horkhe authored Oct 11, 2023
2 parents a48500e + 580b1cf commit ac2cd7a
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 ac2cd7a

Please sign in to comment.