Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: should waitGroup add before go routine starts (#2150)

p0ny78d21d9de13e
diff --git a/server/server.go b/server/server.go
index 9a25bc4079..1d7dcf50b7 100644
--- a/server/server.go
+++ b/server/server.go
@@ -425,6 +425,7 @@ func (s *Server) Run(ctx context.Context) error {
s.cancel = cancel
if !s.profile.Readonly {
// runnerWG waits for all goroutines to complete.
+ s.runnerWG.Add(1)
go s.TaskScheduler.Run(ctx, &s.runnerWG)
s.runnerWG.Add(1)
go s.TaskCheckScheduler.Run(ctx, &s.runnerWG)
@@ -434,11 +435,10 @@ func (s *Server) Run(ctx context.Context) error {
go s.BackupRunner.Run(ctx, &s.runnerWG)
s.runnerWG.Add(1)
go s.AnomalyScanner.Run(ctx, &s.runnerWG)
- s.runnerWG.Add(1)
if s.MetricReporter != nil {
- go s.MetricReporter.Run(ctx, &s.runnerWG)
s.runnerWG.Add(1)
+ go s.MetricReporter.Run(ctx, &s.runnerWG)
}
}