Fix signaler on Windows

This commit is contained in:
Deluan 2024-04-28 18:32:28 -04:00
parent 3d9fff36f7
commit 7ab7b5df5e
3 changed files with 54 additions and 25 deletions

View file

@ -122,31 +122,6 @@ func startServer(ctx context.Context) func() error {
}
}
func startSignaler(ctx context.Context) func() error {
log.Info("Starting signaler")
scanner := GetScanner()
return func() error {
var sigChan = make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGUSR1)
for {
select {
case sig := <-sigChan:
log.Info("Received signal, triggering a new scan", "signal", sig)
start := time.Now()
err := scanner.RescanAll(ctx, false)
if err != nil {
log.Error("Error scanning", err)
}
log.Info("Triggered scan complete", "elapsed", time.Since(start).Round(100*time.Millisecond))
case <-ctx.Done():
return nil
}
}
}
}
func schedulePeriodicScan(ctx context.Context) func() error {
return func() error {
schedule := conf.Server.ScanSchedule