You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/04/13 08:03:16 UTC

[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #941: SCB-2094 Bugfix: Heartbeat plug-in initialization should be locked

tianxiaoliang commented on a change in pull request #941:
URL: https://github.com/apache/servicecomb-service-center/pull/941#discussion_r612220014



##########
File path: datasource/mongo/heartbeat/manager.go
##########
@@ -28,11 +29,14 @@ type healthCheckEngine func(opts Options) (HealthCheck, error)
 var (
 	plugins             = make(map[ImplName]healthCheckEngine)
 	healthCheckInstance HealthCheck
+	mu                  sync.RWMutex
 )
 
 // load plugins configuration into plugins
 func Install(pluginImplName string, engineFunc healthCheckEngine) {
+	mu.Lock()
 	plugins[ImplName(pluginImplName)] = engineFunc

Review comment:
       defer




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org