|
@@ -136,10 +136,13 @@ func (a *aggregator) mainLoop(in <-chan fs.Event, out chan<- []string, cfg *conf
|
|
a.notifyTimer = time.NewTimer(a.notifyDelay)
|
|
a.notifyTimer = time.NewTimer(a.notifyDelay)
|
|
defer a.notifyTimer.Stop()
|
|
defer a.notifyTimer.Stop()
|
|
|
|
|
|
- inProgress := make(map[string]struct{})
|
|
|
|
inProgressItemSubscription := events.Default.Subscribe(events.ItemStarted | events.ItemFinished)
|
|
inProgressItemSubscription := events.Default.Subscribe(events.ItemStarted | events.ItemFinished)
|
|
|
|
+ defer events.Default.Unsubscribe(inProgressItemSubscription)
|
|
|
|
|
|
cfg.Subscribe(a)
|
|
cfg.Subscribe(a)
|
|
|
|
+ defer cfg.Unsubscribe(a)
|
|
|
|
+
|
|
|
|
+ inProgress := make(map[string]struct{})
|
|
|
|
|
|
for {
|
|
for {
|
|
select {
|
|
select {
|
|
@@ -154,7 +157,6 @@ func (a *aggregator) mainLoop(in <-chan fs.Event, out chan<- []string, cfg *conf
|
|
case folderCfg := <-a.folderCfgUpdate:
|
|
case folderCfg := <-a.folderCfgUpdate:
|
|
a.updateConfig(folderCfg)
|
|
a.updateConfig(folderCfg)
|
|
case <-a.ctx.Done():
|
|
case <-a.ctx.Done():
|
|
- cfg.Unsubscribe(a)
|
|
|
|
l.Debugln(a, "Stopped")
|
|
l.Debugln(a, "Stopped")
|
|
return
|
|
return
|
|
}
|
|
}
|