Skip to content

Commit 6fffc97

Browse files
scydasscyda
authored and
scyda
committed
fix shutdown the storage factory
Signed-off-by: scydas <[email protected]> Signed-off-by: scyda <[email protected]>
1 parent 1ff7416 commit 6fffc97

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

cmd/clustersynchro-manager/app/synchro.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ func NewClusterSynchroManagerCommand(ctx context.Context) *cobra.Command {
6262
return err
6363
}
6464

65+
defer func() {
66+
err := config.StorageFactory.Shutdown()
67+
if err != nil {
68+
klog.ErrorS(err, "Failed to shutdown storage factory")
69+
}
70+
}()
71+
6572
if err := Run(ctx, config); err != nil {
6673
return err
6774
}
@@ -91,14 +98,6 @@ func Run(ctx context.Context, c *config.Config) error {
9198
metricsserver.Run(c.MetricsServerConfig)
9299
}()
93100

94-
go func() {
95-
<-ctx.Done()
96-
err := c.StorageFactory.Shutdown()
97-
if err != nil {
98-
klog.ErrorS(err, "Failed to shutdown storage factory")
99-
}
100-
}()
101-
102101
if c.KubeMetricsServerConfig != nil {
103102
go func() {
104103
kubestatemetrics.RunServer(*c.KubeMetricsServerConfig, synchromanager)

0 commit comments

Comments
 (0)