Skip to content

Commit 30d480e

Browse files
feat(assets): async two-phase scanner and background seeder
- Rewrite scanner.py with two-phase scanning architecture (fast scan + enrich) - Add AssetSeeder for non-blocking background startup scanning - Implement pause/resume/stop/restart controls and disable/enable for --disable-assets-autoscan - Add non-destructive asset pruning with is_missing flag - Wire seeder into main.py and server.py lifecycle - Skip hidden files/directories, populate mime_type, optional blake3 hashing - Add comprehensive seeder tests Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c9209-37af-757a-b6e4-af59b4267362
1 parent 8c54565 commit 30d480e

File tree

6 files changed

+2099
-240
lines changed

6 files changed

+2099
-240
lines changed

app/assets/api/routes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
delete_temp_file_if_exists,
2020
parse_multipart_upload,
2121
)
22-
from app.assets.seeder import asset_seeder
22+
from app.assets.seeder import ScanInProgressError, asset_seeder
2323
from app.assets.services import (
2424
DependencyMissingError,
2525
HashMismatchError,
@@ -717,8 +717,9 @@ async def mark_missing_assets(request: web.Request) -> web.Response:
717717
200 OK with count of marked assets
718718
409 Conflict if a scan is currently running
719719
"""
720-
marked = asset_seeder.mark_missing_outside_prefixes()
721-
if marked == 0 and asset_seeder.get_status().state.value != "IDLE":
720+
try:
721+
marked = asset_seeder.mark_missing_outside_prefixes()
722+
except ScanInProgressError:
722723
return web.json_response(
723724
{"status": "scan_running", "marked": 0},
724725
status=409,

0 commit comments

Comments
 (0)