lib/model: Allow limiting number of concurrent scans (fixes #2760) (#4888)

This commit is contained in:
Audrius Butkevicius
2018-12-05 07:40:05 +00:00
committed by Jakob Borg
parent 0fe4c01a28
commit ff2cde469e
8 changed files with 154 additions and 6 deletions

View File

@@ -170,6 +170,7 @@ func NewModel(cfg *config.Wrapper, id protocol.DeviceID, clientName, clientVersi
if cfg.Options().ProgressUpdateIntervalS > -1 {
go m.progressEmitter.Serve()
}
scanLimiter.setCapacity(cfg.Options().MaxConcurrentScans)
cfg.Subscribe(m)
return m
@@ -2586,6 +2587,8 @@ func (m *Model) CommitConfiguration(from, to config.Configuration) bool {
}
}
scanLimiter.setCapacity(to.Options.MaxConcurrentScans)
// Some options don't require restart as those components handle it fine
// by themselves. Compare the options structs containing only the
// attributes that require restart and act apprioriately.