Spaces:
Sleeping
Sleeping
Commit History
-
Reliability: bake ESM-2 weights + bound in-memory jobs/rate-limit
Tengo Gzirishvili +1: Claude Opus 4.8Three audit quick-wins: - Dockerfile: HF_HOME moved to a BAKED /opt/hf-cache and the default ESM-2 (35M) weights are prefetched at build time, so a cold start no longer re-downloads them (HF_HOME used to live under ephemeral /tmp). Best-effort prefetch (|| echo) so a build-time hiccup can't break the image — it just lazy-loads at runtime. - server.py: cap _JOBS at 2000 and evict the oldest (with their edit locks) so a long-lived worker can't grow unbounded. - server.py: the rate-limit table now evicts the STALEST buckets when it gets large, instead of clear()-ing the whole thing (which reset every honest user's window and could be abused by a unique-IP flood). Verified: 324 tests pass; _JOBS cap evicts oldest + prunes locks; rate-limit drops stalest buckets (recent kept), no global wipe. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>843e792 -
Reliability: run on gunicorn (auto-restart) + add /healthz
Tengo Gzirishvili +1: Claude Opus 4.8The biggest "trust = uptime" fix from the audit. The Space ran on Flask's dev server (Werkzeug) with no supervisor — one unhandled error downed it until a manual reboot. Now it runs under gunicorn: - Dockerfile CMD → gunicorn dee.server:build_app(), ONE gthread worker (state lives in-process: jobs, sessions, rate-limit, the cached scorer — so a single worker is required), 8 threads for concurrency, 120s timeout (the model load runs in a background thread so requests stay fast). The master auto-restarts the worker on a crash → an error no longer takes the whole Space down. - server.py: extract build_app() (logging + off-target prewarm + create_app) as the shared WSGI entry; serve() reuses it for local dev so both paths behave identically. Add a no-auth /healthz liveness route for an uptime monitor. - requirements.txt: add gunicorn. Verified locally with the exact prod invocation: 324 tests pass; gunicorn boots gthread/1-worker; /healthz -> 200 {"status":"ok"}; / -> 200. C…1259937
-
Initial deploy · DEE Flask app via Docker SDK
Verified signature060bb47