Update cache management in ApiRoutes to remove hash index by file path

- Added functionality to update the hash index by removing entries associated with the specified file path during cache management.
- Ensured that the cache is properly resorted after the removal of raw data items.
This commit is contained in:
Will Miao
2025-03-23 16:50:56 +08:00
parent e216b4c455
commit 27248b197d

View File

@@ -269,6 +269,9 @@ class ApiRoutes:
cache = await self.scanner.get_cached_data()
cache.raw_data = [item for item in cache.raw_data if item['file_path'] != main_path]
await cache.resort()
# update hash index
self.scanner._hash_index.remove_by_path(main_path)
# Delete optional files
for pattern in patterns[1:]: