Skip to content

🎧 Your Personal Streaming Service

fix(server): use cancellable context instead of Sleep for initial insights delay (#3593)

Kendall Garnerf0302525a700
diff --git a/cmd/root.go b/cmd/root.go
index 7a3104543..3a1757be9 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -208,7 +208,11 @@ func startInsightsCollector(ctx context.Context) func() error {
return nil
}
log.Info(ctx, "Starting Insight Collector")
- time.Sleep(conf.Server.DevInsightsInitialDelay)
+ select {
+ case <-time.After(conf.Server.DevInsightsInitialDelay):
+ case <-ctx.Done():
+ return nil
+ }
ic := CreateInsights()
ic.Run(ctx)
return nil