release: v0.5.13 — robustness fixes from full-project audit
- executor.py: wrap shutil.rmtree/os.makedirs in try/except OSError so a permission failure logs and skips the job rather than aborting the run - cache.py: write embeddings to a .tmp file and atomically rename into place via os.replace so a process kill can't leave a corrupted .npy cache slot - immich_api.py: guard fileCreatedAt with isinstance(str) check before calling .replace() so a non-string timestamp doesn't raise AttributeError and kill the entire filter_recent_assets pass - upload_tracker.py: raise SQLite busy timeout from 5 s to 30 s to handle concurrent cron+manual run overlap without dropping upload-tracking records
This commit is contained in:
+8
-1
@@ -82,10 +82,17 @@ class EmbeddingCache:
|
||||
def put(self, asset_id: str, embedding: np.ndarray, model: str = "insightface") -> None:
|
||||
"""Store an embedding in the cache."""
|
||||
self._ensure_dir()
|
||||
final = self._path(asset_id, model)
|
||||
tmp = final + ".tmp"
|
||||
try:
|
||||
np.save(self._path(asset_id, model), embedding)
|
||||
np.save(tmp, embedding)
|
||||
os.replace(tmp, final)
|
||||
except Exception as e:
|
||||
logger.debug("Cache write failed for %s: %s", asset_id, e)
|
||||
try:
|
||||
os.remove(tmp)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def clear(self) -> None:
|
||||
"""Delete all cached embeddings."""
|
||||
|
||||
Reference in New Issue
Block a user