fix: Reduce log spam for missing watch paths
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
6
main.py
6
main.py
@@ -45,6 +45,7 @@ def main():
|
|||||||
global timer
|
global timer
|
||||||
watch_flags = flags.MODIFY | flags.CREATE | flags.DELETE | flags.MOVED_FROM | flags.MOVED_TO
|
watch_flags = flags.MODIFY | flags.CREATE | flags.DELETE | flags.MOVED_FROM | flags.MOVED_TO
|
||||||
wd_to_path = {}
|
wd_to_path = {}
|
||||||
|
missing_paths = set()
|
||||||
|
|
||||||
with INotify() as inotify:
|
with INotify() as inotify:
|
||||||
try:
|
try:
|
||||||
@@ -53,9 +54,14 @@ def main():
|
|||||||
for path in secrets.WATCH_PATHS:
|
for path in secrets.WATCH_PATHS:
|
||||||
if path not in watched_dirs:
|
if path not in watched_dirs:
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
|
if path in missing_paths:
|
||||||
|
logging.info(f"Watch path {path} is now available.")
|
||||||
|
missing_paths.remove(path)
|
||||||
add_watch_recursive(inotify, path, watch_flags, wd_to_path)
|
add_watch_recursive(inotify, path, watch_flags, wd_to_path)
|
||||||
else:
|
else:
|
||||||
|
if path not in missing_paths:
|
||||||
logging.warning(f"Watch path {path} does not exist. Will retry.")
|
logging.warning(f"Watch path {path} does not exist. Will retry.")
|
||||||
|
missing_paths.add(path)
|
||||||
|
|
||||||
events = inotify.read(timeout=1000)
|
events = inotify.read(timeout=1000)
|
||||||
if events:
|
if events:
|
||||||
|
|||||||
Reference in New Issue
Block a user