Skip to content

Commit

Permalink
fix: service-prometheus node discovery dead lock, issue TencentBlueKi…
Browse files Browse the repository at this point in the history
  • Loading branch information
DeveloperJim committed Nov 11, 2020
1 parent 12032c3 commit 29c32ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
2 changes: 2 additions & 0 deletions bcs-network/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,8 @@ k8s.io/client-go v0.18.2 h1:aLB0iaD4nmwh7arT2wIn+lMnAq7OswjaejkQ8p9bBYE=
k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU=
k8s.io/client-go v0.18.6 h1:I+oWqJbibLSGsZj8Xs8F0aWVXJVIoUHWaaJV3kUN/Zw=
k8s.io/client-go v0.18.6/go.mod h1:/fwtGLjYMS1MaM5oi+eXhKwG+1UHidUEXRh6cNsdO0Q=
k8s.io/client-go v1.5.1 h1:XaX/lo2/u3/pmFau8HN+sB5C/b4dc4Dmm2eXjBH4p1E=
k8s.io/client-go v11.0.0+incompatible h1:LBbX2+lOwY9flffWlJM7f1Ct8V2SRNiMRDFeiwnJo9o=
k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc=
k8s.io/code-generator v0.18.5/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
k8s.io/code-generator v0.18.6/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ func (disc *nodeEtcdDiscovery) Start() error {
}

func (disc *nodeEtcdDiscovery) GetPrometheusSdConfig(module string) ([]*types.PrometheusSdConfig, error) {
disc.Lock()
disc.Unlock()
promConfigs := make([]*types.PrometheusSdConfig, 0)
for nodeIP := range disc.nodes {
switch disc.module {
Expand Down Expand Up @@ -138,9 +136,6 @@ func (disc *nodeEtcdDiscovery) RegisterEventFunc(handleFunc EventHandleFunc) {

// OnAdd add event handler
func (disc *nodeEtcdDiscovery) OnAdd(obj interface{}) {
disc.Lock()
defer disc.Unlock()

agent, ok := obj.(*apisbkbcsv2.Agent)
if !ok {
blog.Errorf("cannot convert to *apisbkbcsv2.Agent: %v", obj)
Expand All @@ -164,9 +159,6 @@ func (disc *nodeEtcdDiscovery) OnUpdate(old, cur interface{}) {

// OnDelete delete event handler
func (disc *nodeEtcdDiscovery) OnDelete(obj interface{}) {
disc.Lock()
defer disc.Unlock()

agent, ok := obj.(*apisbkbcsv2.Agent)
if !ok {
blog.Errorf("cannot convert to *apisbkbcsv2.Agent: %v", obj)
Expand All @@ -183,13 +175,3 @@ func (disc *nodeEtcdDiscovery) OnDelete(obj interface{}) {
// call event handler
disc.eventHandler(Info{Module: disc.module, Key: disc.module})
}

/*func (disc *nodeEtcdDiscovery) syncTickerPromSdConfig() {
ticker := time.NewTicker(time.Minute * 5)
select {
case <-ticker.C:
blog.V(3).Infof("ticker sync prometheus service discovery config")
disc.eventHandler(DiscoveryInfo{Module: disc.module, Key: disc.module})
}
}*/

0 comments on commit 29c32ae

Please sign in to comment.