mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
fix(scanner): make activity panel update rate configurable
This commit is contained in:
parent
3a0ddd5fc4
commit
a5c3796e6e
@ -101,6 +101,7 @@ type configOptions struct {
|
||||
DevAutoCreateAdminPassword string
|
||||
DevAutoLoginUsername string
|
||||
DevActivityPanel bool
|
||||
DevActivityPanelUpdateRate time.Duration
|
||||
DevSidebarPlaylists bool
|
||||
DevEnableBufferedScrobble bool
|
||||
DevShowArtistPage bool
|
||||
@ -389,6 +390,7 @@ func init() {
|
||||
viper.SetDefault("devautocreateadminpassword", "")
|
||||
viper.SetDefault("devautologinusername", "")
|
||||
viper.SetDefault("devactivitypanel", true)
|
||||
viper.SetDefault("devactivitypanelupdaterate", 300*time.Millisecond)
|
||||
viper.SetDefault("enablesharing", false)
|
||||
viper.SetDefault("shareurl", "")
|
||||
viper.SetDefault("defaultdownloadableshare", false)
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/navidrome/navidrome/conf"
|
||||
"github.com/navidrome/navidrome/core"
|
||||
"github.com/navidrome/navidrome/core/artwork"
|
||||
"github.com/navidrome/navidrome/log"
|
||||
@ -119,7 +120,7 @@ func (s *scanner) startProgressTracker(library string) (chan uint32, context.Can
|
||||
// Must be a new context (not the one passed to the scan method) to allow broadcasting the scan status to all clients
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
progress := make(chan uint32, 1000)
|
||||
limiter := rate.Sometimes{Every: 10}
|
||||
limiter := rate.Sometimes{Interval: conf.Server.DevActivityPanelUpdateRate}
|
||||
go func() {
|
||||
s.broker.SendMessage(ctx, &events.ScanStatus{Scanning: true, Count: 0, FolderCount: 0})
|
||||
defer func() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user