fix: address 3 quality review findings — tracker_ok gate, LIMIT=0 warning, cache write log level
This commit is contained in:
+1
-1
@@ -90,7 +90,7 @@ class EmbeddingCache:
|
||||
np.save(tmp, embedding)
|
||||
os.replace(tmp, final)
|
||||
except Exception as e:
|
||||
logger.debug("Cache write failed for %s: %s", asset_id, e)
|
||||
logger.warning("Cache write failed for %s: %s", asset_id, e)
|
||||
try:
|
||||
os.remove(tmp)
|
||||
except OSError:
|
||||
|
||||
@@ -507,6 +507,7 @@ def upload_to_frigate(jobs: list[dict]) -> None:
|
||||
|
||||
asset_id = asset_map.get(fname)
|
||||
if asset_id:
|
||||
tracker_ok = True
|
||||
try:
|
||||
mark_uploaded(
|
||||
asset_id,
|
||||
@@ -516,6 +517,7 @@ def upload_to_frigate(jobs: list[dict]) -> None:
|
||||
frigate_score=pre_fscore,
|
||||
)
|
||||
except Exception as tracker_exc:
|
||||
tracker_ok = False
|
||||
# Upload to Frigate succeeded — don't retry on tracker
|
||||
# failure or we'd upload a duplicate to Frigate.
|
||||
logger.error(
|
||||
@@ -523,6 +525,7 @@ def upload_to_frigate(jobs: list[dict]) -> None:
|
||||
" but asset may be re-selected next run: %s",
|
||||
fname, tracker_exc,
|
||||
)
|
||||
if tracker_ok:
|
||||
if pre_fscore is not None:
|
||||
person_has_fscores = True
|
||||
actually_uploaded.append((fname, asset_id))
|
||||
|
||||
@@ -70,6 +70,8 @@ def _resolve_strategy(strategy: str, has_embedding: bool) -> tuple[int | str, st
|
||||
|
||||
custom_limit = _getenv_optional_int("LIMIT")
|
||||
if custom_limit is not None:
|
||||
if custom_limit == 0:
|
||||
logger.warning("LIMIT=0 selects zero images — set LIMIT to a positive integer or leave unset for auto")
|
||||
return custom_limit, "smart"
|
||||
|
||||
strategy_map = {
|
||||
|
||||
Reference in New Issue
Block a user