Skip to content

Commit

Permalink
Fix(?) watcher queue sometimes not stopping when asked
Browse files Browse the repository at this point in the history
Ref #263
  • Loading branch information
spl0k committed Apr 14, 2024
1 parent 1cfca94 commit 4a0437b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions supysonic/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ def __run(self):
time.sleep(0.1)

with self.__cond:
self.__cond.wait()
# Flag might have flipped during sleep. Check it again before waiting
# See issue #263
if self.__running:
self.__cond.wait()

if not self.__queue:
continue
Expand Down Expand Up @@ -195,8 +198,8 @@ def __process_cover_item(self, scanner, item):
scanner.add_cover(item.path)

def stop(self):
self.__running = False
with self.__cond:
self.__running = False
self.__cond.notify()

def put(self, path, operation, **kwargs):
Expand Down

0 comments on commit 4a0437b

Please sign in to comment.