fix: address code review — unused import, silent except, gallery cache

- Remove unused `patch` import from test_output_dir.py
- Add debug log message to ImportError handler instead of bare pass
- Invalidate gallery file listing cache alongside output dir cache
  when the user changes gallery_root_path in settings
This commit is contained in:
Vito Sansevero
2026-02-09 05:46:38 -08:00
parent 6a5834e243
commit 30f83f2401
3 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -482,7 +482,9 @@ class PromptManagerAPI(
f"Configured directory does not exist: {GalleryConfig.MONITORING_DIRECTORIES[0]}"
)
except ImportError:
pass
self.logger.debug(
"GalleryConfig not available, skipping configured directory check"
)
current_file = Path(__file__).resolve()
self.logger.debug(f"Starting ComfyUI output search from: {current_file}")
+3 -1
View File
@@ -448,8 +448,10 @@ class AdminRoutesMixin:
GalleryConfig.MONITORING_DIRECTORIES = [new_path]
else:
GalleryConfig.MONITORING_DIRECTORIES = []
# Invalidate cached output dir so next lookup uses new config
# Invalidate caches so next lookup uses new config
self._cached_output_dir = None
self._gallery_cache = None
self._gallery_cache_time = 0
restart_required = True
# Save to config file for persistence