• Stefy Lanza (nextime / spora )'s avatar
    perf: gate cache scans on a cheap dir-mtime signature (only re-scan on change) · 0bc9ba76
    Stefy Lanza (nextime / spora ) authored
    Capability detection is already name-based (microsecond-fast), so caching it
    wouldn't help — the real cost is huggingface_hub.scan_cache_dir() + the per-file
    size sums walking the whole cache. So instead of re-walking on a TTL, the
    cached-models/cache-stats layer now computes a cheap change-signature (the names +
    mtimes of the top-level model dirs/files — a handful of stat() calls) and only does
    the expensive scan when that signature changes. Unchanged caches return the last
    result instantly and never re-walk; a change refreshes in the background. A long
    600s backstop TTL still re-scans occasionally. Mutating ops reset the signature.
    
    Net: the models page is instant on every load and the background refresh only runs
    when models are actually added/removed/downloaded.
    
    Verified: unchanged signature → 0 rescans; changed signature → one background rescan.
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_011DDv7BchtZQWsnPG6Jm49m
    0bc9ba76
Name
Last commit
Last update
..
admin Loading commit data...
api Loading commit data...
backends Loading commit data...
broker Loading commit data...
frontproxy Loading commit data...
models Loading commit data...
openai Loading commit data...
pydantic Loading commit data...
queue Loading commit data...
tasks Loading commit data...
__init__.py Loading commit data...
cli.py Loading commit data...
config.py Loading commit data...
main.py Loading commit data...
platform_paths.py Loading commit data...
system_app.py Loading commit data...