fix: embedding cache key mismatch, scheduler path/exception, log handler leak
embeddings.py: face embedding cache used 'immich' for lookup but 'insightface' for storage, so the cache was never hit for locally- computed embeddings. Unified to 'insightface'/'siglip' throughout. This affects all users since ENABLE_CACHE now defaults to true. scheduler.py: INSIGHTFACE_HOME=/models/.insightface was having '.insightface' appended again, making buffalo_l check always report 'will download'. Also catch BaseException (not just Exception) so a SystemExit from a library call can't silently kill all future runs. log_config.py: handlers.clear() abandoned open FileHandler fds on each scheduled main() call. Close each handler properly before removal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-3
@@ -17,13 +17,13 @@ from winnow.cli import main
|
||||
|
||||
SCHEDULE = os.environ["CRON_SCHEDULE"]
|
||||
MODELS_DIR = os.environ.get("HF_HOME", "/models/huggingface")
|
||||
INSIGHTFACE_BASE = os.environ.get("INSIGHTFACE_HOME", "/models")
|
||||
INSIGHTFACE_HOME = os.environ.get("INSIGHTFACE_HOME", "/models/.insightface")
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def check_models() -> None:
|
||||
buffalo = Path(INSIGHTFACE_BASE) / ".insightface" / "models" / "buffalo_l"
|
||||
buffalo = Path(INSIGHTFACE_HOME) / "models" / "buffalo_l"
|
||||
hf_hub = Path(MODELS_DIR) / "hub"
|
||||
if not buffalo.exists():
|
||||
print(" InsightFace Buffalo_L not found — will download on first run", flush=True)
|
||||
@@ -43,7 +43,9 @@ while True:
|
||||
try:
|
||||
main()
|
||||
print("winnow run complete", flush=True)
|
||||
except Exception as e:
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except BaseException as e:
|
||||
logger.error(f"winnow run failed: {e}", exc_info=True)
|
||||
print(f"winnow run failed: {e}", flush=True)
|
||||
next_run = cron.get_next(float)
|
||||
|
||||
Reference in New Issue
Block a user