Skip to content

Commit

Permalink
修正新增目录可能监听失败
Browse files Browse the repository at this point in the history
  • Loading branch information
fengqi committed May 27, 2023
1 parent 2861fc7 commit 0a5af4e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions music_videos/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ func (c *Collector) runWatcher() {

// 新增目录
if fileInfo.IsDir() {
err = c.watcher.Add(event.Name)
if err != nil {
utils.Logger.WarningF("add music video dir: %s to watcher err: %v", event.Name, err)
}

videos, err := c.scanDir(event.Name)
if err != nil || len(videos) == 0 {
utils.Logger.WarningF("new dir %s scan err: %v", event.Name, err)
Expand All @@ -84,11 +89,6 @@ func (c *Collector) runWatcher() {
c.channel <- video
}

err = c.watcher.Add(event.Name)
if err != nil {
utils.Logger.FatalF("add music video dir: %s to watcher err: %v", event.Name, err)
}

continue
}

Expand Down

0 comments on commit 0a5af4e

Please sign in to comment.