mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
cleanup: reduce complexity of rbd.Driver.Run()
After adding the new CSI-Addons Server, golang-ci complains that driver.Run() is too complex. By moving the profiling checks and starting of the go-routines in their own function, golang-ci is happy again. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
b3910f2b4a
commit
20727bd41a
@ -214,13 +214,9 @@ func (r *Driver) Run(conf *util.Config) {
|
|||||||
log.WarningLogMsg("EnableGRPCMetrics is deprecated")
|
log.WarningLogMsg("EnableGRPCMetrics is deprecated")
|
||||||
go util.StartMetricsServer(conf)
|
go util.StartMetricsServer(conf)
|
||||||
}
|
}
|
||||||
if conf.EnableProfiling {
|
|
||||||
if !conf.EnableGRPCMetrics {
|
r.startProfiling(conf)
|
||||||
go util.StartMetricsServer(conf)
|
|
||||||
}
|
|
||||||
log.DebugLogMsg("Registering profiling handler")
|
|
||||||
go util.EnableProfiling()
|
|
||||||
}
|
|
||||||
if conf.IsNodeServer {
|
if conf.IsNodeServer {
|
||||||
go func() {
|
go func() {
|
||||||
// TODO: move the healer to csi-addons
|
// TODO: move the healer to csi-addons
|
||||||
@ -255,3 +251,15 @@ func (r *Driver) setupCSIAddonsServer(endpoint string) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// startProfiling checks which profiling options are enabled in the config and
|
||||||
|
// starts the required profiling services.
|
||||||
|
func (r *Driver) startProfiling(conf *util.Config) {
|
||||||
|
if conf.EnableProfiling {
|
||||||
|
if !conf.EnableGRPCMetrics {
|
||||||
|
go util.StartMetricsServer(conf)
|
||||||
|
}
|
||||||
|
log.DebugLogMsg("Registering profiling handler")
|
||||||
|
go util.EnableProfiling()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user