Skip to content
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

Renew cert fix #173

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

mykola-kobets-epam
Copy link
Collaborator

No description provided.

@mykola-kobets-epam mykola-kobets-epam force-pushed the renew-cert-fix branch 2 times, most recently from e8d042b to 9a84c96 Compare October 17, 2024 10:11
Copy link

sonarcloud bot commented Oct 17, 2024

}

if err := controller.startGRPCServer(); err != nil {
log.WithField("err", err).Error("SMController failed to start GRPC server")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SM controller

@@ -29,6 +29,8 @@ import (
"sync"
"time"

"golang.org/x/exp/slices"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to duplicate module name in commit message.

enterPrefix + stateIdle: umCtrl.processIdleState,
enterPrefix + stateReconnecting: umCtrl.processEnterReconnectingState,
leavePrefix + stateReconnecting: umCtrl.processLeaveReconnectingState,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line

"sync"
"sync/atomic"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto for commit message

// GetNodeInfo returns node info.
func (client *Client) GetNodeInfo(nodeID string) (nodeInfo cloudprotocol.NodeInfo, err error) {
client.Lock()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grpc calls are thread-safe why this lock is required here and in others API?

log.WithField("err", err).Error("CMServer failed to start GRPC server")

server.restartTimer = time.AfterFunc(cmRestartInterval, func() {
server.restartTimer = nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be guarded with mutex.


eventChannel chan umCtrlInternalMsg
nodeInfoProvider NodeInfoProvider
nodeInfoChannel <-chan cloudprotocol.NodeInfo
stopChannel chan bool
componentDir string
certChan <-chan *iamanager.CertInfo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

certChannel

eventChannel: make(chan umCtrlInternalMsg),
nodeInfoProvider: nodeInfoProvider,
nodeInfoChannel: nodeInfoProvider.SubscribeNodeInfoChange(),
certChan: make(<-chan *iamanager.CertInfo),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove make

if !insecure {
if ch, err := localClient.SubscribeCertChanged(config.CertStorage); err != nil {
return nil, aoserrors.Wrap(err)
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need else after return.


secureOpt = grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig))
func (client *Client) reconnect() {
if client.disableReconnect.CompareAndSwap(false, true) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unclear why disableReconnect is required. Need to discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants