-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NET-655 #628
NET-655 #628
Conversation
* draft code for NET-655
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it not be simpler to start the fallback go routine in the mq connection lost handler and stop it in the mq connection handler
* Added ticker for MQ Fallback Main thread. * Added wait groups so that threads close properly. * Added atomic sync for thread status boolean.
* Fixed variables scoping * Added fallback pull function
* fixed server version empty string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is way over complicated with starting stopping the fallback function all over the place:
just need to start fallback go routine and let it run
func MQFallback(ctx contex.Context, wg *sync.WaitGroup) {
defer wg.Done()
for {
select {
case <-ctx.Done():
fallbackTicker.Stop()
return
case <-fallbackTicker.C:
if Mqclient == nil || !Mqclient.IsConnected() {
response, err := pull(false)
if err != nil {
slog.Error("pull failed", "error", err)
} else {
MQFallbackPull(response)
}
}
}
}
}
* fallback mechanism optimization
* further optimization of mq fallback goroutine.
* reset interface if new node.
* fallback goroutine context and waitgroup changed.
* mq connection re-attempt after successful pull.
* reset interface network change scenario
* resolving merge conflicts
* changed the network ip change check logic.
* Only skip tick for no current server only if primary mq fallback conditions are met.
Describe your changes
Related to -> gravitl/netmaker#2670
Provide Issue ticket number if applicable/not in title
Provide link to Netmaker PR if required
Provide testing steps
Checklist before requesting a review