Skip to content

Commit 6902850

Browse files
committed
shares.py: accurate current_folder_count during rescan
1 parent 0ec9d5d commit 6902850

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pynicotine/shares.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ def scan_shared_folder(self, shared_folder_path, old_mtimes, old_files):
532532
# Sharing a folder twice, no go
533533
continue
534534

535+
self.queue.put(self.current_folder_count)
536+
535537
file_list = []
536538

537539
try:
@@ -544,11 +546,7 @@ def scan_shared_folder(self, shared_folder_path, old_mtimes, old_files):
544546
if self.is_hidden(path, entry=entry):
545547
continue
546548

547-
self.current_folder_count += 1
548549
folder_paths.append(path)
549-
550-
if not self.current_folder_count % 100:
551-
self.queue.put(self.current_folder_count)
552550
continue
553551

554552
try:
@@ -593,6 +591,7 @@ def scan_shared_folder(self, shared_folder_path, old_mtimes, old_files):
593591
)
594592

595593
self.streams[virtual_folder_path] = self.get_folder_stream(file_list)
594+
self.current_folder_count += 1
596595

597596
def get_audio_tag(self, file_path, size):
598597

@@ -1107,7 +1106,7 @@ def _process_scanner(self, scanner_queue, emit_event=None):
11071106

11081107
successful = True
11091108

1110-
while self._scanner_process.is_alive():
1109+
while self._scanner_process.is_alive() and successful:
11111110
# Cooldown
11121111
time.sleep(0.05)
11131112

0 commit comments

Comments
 (0)