Fix watching new subdirs in collection watcher

This commit is contained in:
Jonas Kvinge 2019-08-02 23:58:47 +02:00
parent 2d3f41da6f
commit 7b13c0d059
1 changed files with 9 additions and 9 deletions

View File

@ -143,15 +143,7 @@ CollectionWatcher::ScanTransaction::~ScanTransaction() {
// If we're stopping then don't commit the transaction // If we're stopping then don't commit the transaction
if (!watcher_->stop_requested_) { if (!watcher_->stop_requested_) {
CommitNewOrUpdatedSongs(); CommitNewOrUpdatedSongs();
if (watcher_->monitor_) {
// Watch the new subdirectories
for (const Subdirectory &subdir : new_subdirs) {
watcher_->AddWatch(watcher_->watched_dirs_[dir_], subdir.path);
}
}
} }
watcher_->task_manager_->SetTaskFinished(task_id_); watcher_->task_manager_->SetTaskFinished(task_id_);
@ -196,7 +188,6 @@ void CollectionWatcher::ScanTransaction::CommitNewOrUpdatedSongs() {
if (!new_subdirs.isEmpty()) { if (!new_subdirs.isEmpty()) {
emit watcher_->SubdirsDiscovered(new_subdirs); emit watcher_->SubdirsDiscovered(new_subdirs);
new_subdirs.clear();
} }
if (!touched_subdirs.isEmpty()) { if (!touched_subdirs.isEmpty()) {
@ -204,6 +195,15 @@ void CollectionWatcher::ScanTransaction::CommitNewOrUpdatedSongs() {
touched_subdirs.clear(); touched_subdirs.clear();
} }
if (watcher_->monitor_) {
// Watch the new subdirectories
for (const Subdirectory &subdir : new_subdirs) {
watcher_->AddWatch(watcher_->watched_dirs_[dir_], subdir.path);
}
}
new_subdirs.clear();
} }