optimization: fast scan: commit to the DB in chunks

This commit is contained in:
bigcat88
2025-09-16 14:21:40 +03:00
parent 24a95f5ca4
commit 77332d3054
2 changed files with 49 additions and 44 deletions

View File

@@ -87,6 +87,7 @@ async def ensure_seed_for_path(
state_row.needs_verify = True
if asset_row.size_bytes == 0 and size_bytes > 0:
asset_row.size_bytes = int(size_bytes)
await session.flush()
return asset_row.id
asset = Asset(hash=None, size_bytes=int(size_bytes), mime_type=None, created_at=now)