mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Fix SIGUSR1 work when ScanInterval=0
This commit is contained in:
parent
a35de2bfd1
commit
8a07bac2a2
3 changed files with 45 additions and 19 deletions
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -40,10 +39,7 @@ type FolderScanner interface {
|
|||
Scan(ctx context.Context, lastModifiedSince time.Time, progress chan uint32) error
|
||||
}
|
||||
|
||||
var (
|
||||
isScanning utils.AtomicBool
|
||||
sigChan = make(chan os.Signal, 1)
|
||||
)
|
||||
var isScanning utils.AtomicBool
|
||||
|
||||
type scanner struct {
|
||||
folders map[string]FolderScanner
|
||||
|
@ -87,9 +83,6 @@ func (s *scanner) Run(ctx context.Context, interval time.Duration) {
|
|||
select {
|
||||
case <-ticker.C:
|
||||
continue
|
||||
case sig := <-sigChan:
|
||||
log.Info(ctx, "Received signal, triggering a new scan", "signal", sig)
|
||||
continue
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue