mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-05 01:07:37 +08:00
- Split monolithic queries.py into modular query modules (asset, asset_reference, common, tags) - Absorb bulk_ops.py and tags.py into query modules - Merge migrations 0002-0005 into single migration (0002_merge_to_asset_references) - Update models.py (merge AssetInfo/AssetCacheState into AssetReference) - Enable SQLite foreign key enforcement - Add comprehensive query-layer tests Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c917d-82b5-7448-a04f-9cd59c69d0a2
29 lines
969 B
Python
29 lines
969 B
Python
"""Helper functions for assets integration tests."""
|
|
import time
|
|
|
|
import requests
|
|
|
|
|
|
def trigger_sync_seed_assets(session: requests.Session, base_url: str) -> None:
|
|
"""Force a synchronous sync/seed pass by calling the seed endpoint with wait=true.
|
|
|
|
Retries on 409 (already running) until the previous scan finishes.
|
|
"""
|
|
deadline = time.monotonic() + 60
|
|
while True:
|
|
r = session.post(
|
|
base_url + "/api/assets/seed?wait=true",
|
|
json={"roots": ["models", "input", "output"]},
|
|
timeout=60,
|
|
)
|
|
if r.status_code != 409:
|
|
assert r.status_code == 200, f"seed endpoint returned {r.status_code}: {r.text}"
|
|
return
|
|
if time.monotonic() > deadline:
|
|
raise TimeoutError("seed endpoint stuck in 409 (already running)")
|
|
time.sleep(0.25)
|
|
|
|
|
|
def get_asset_filename(asset_hash: str, extension: str) -> str:
|
|
return asset_hash.removeprefix("blake3:") + extension
|