fix(server): use cancellable context instead of Sleep for initial insights delay (#3593)
* bugfix(server): use cancellable contet instead of sleep for initial insights delay * fix(server): initial delay time Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org> Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
+5
-1
@@ -208,7 +208,11 @@ func startInsightsCollector(ctx context.Context) func() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
log.Info(ctx, "Starting Insight Collector")
|
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 := CreateInsights()
|
||||||
ic.Run(ctx)
|
ic.Run(ctx)
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user