Postgres here allows 60 connections, but each of the 96 gunicorn threads held its own persistent one: at 100 concurrent users (local Postgres with the same limit) 21% of requests were 500 "remaining connection slots are reserved". Now each worker has a psycopg pool (8), so the same load gives 0 errors and 714 req/s (was 460). - A full pool answers 503 + Retry-After (DRF handler and middleware), not 500. - The AI tutor and the OTP SMS call return their connection before the network wait. - statement_timeout 30 s, idle-in-transaction 60 s; bad pool settings and the old DB_CONN_MAX_AGE stop startup instead of failing every request. - /api/health dbPool: per-worker pool stats and workers x pool + 6 vs max_connections. - Indexes on the columns global counters filter by time (weekly leaderboard, global SMS cap, global AI cap); the leaderboard recomputes once per expiry. - Worker count moves into gunicorn.conf.py (4 on a shared 8-core box). - security doc: Redis item closed (server uses our own Redis since 2026-10-08). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.5 KiB
Plaintext
31 lines
1.5 KiB
Plaintext
Django==5.2.17
|
||
djangorestframework==3.18.0
|
||
drf-spectacular==0.30.0
|
||
django-cors-headers==4.9.0
|
||
requests==2.33.1
|
||
redis==5.2.1
|
||
python-dotenv==1.2.2
|
||
whitenoise==6.11.0
|
||
# سرور با همین اجرا میشود (یونیتِ systemd آن را از venv صدا میزند؛ تنظیمات در gunicorn.conf.py).
|
||
gunicorn==26.2.0
|
||
# وابستگیِ غیرمستقیمِ requests و qdrant-client؛ نسخههای پایینتر آسیبپذیریِ شناختهشده دارند
|
||
# (GHSA-8988-9cw3-xx77، GHSA-vxq7-64xx-v4gw، GHSA-gh4c-6fx4-qh6g).
|
||
urllib3==2.8.0
|
||
|
||
# نسخهها همانهاییاند که روی سرور نصب بود (۲۰۲۶-۱۰-۰۷، pip freeze)؛ ارتقا یعنی عوضکردنِ عمدیِ یک خط.
|
||
# RAG / AI tutor (اپ rag). کلاینتها lazy import میشن؛ نبودِ اینها فقط
|
||
# مسیرِ RAG رو از کار میندازه، نه بقیهی پروژه رو.
|
||
openai==2.54.0
|
||
qdrant-client==1.19.0
|
||
|
||
# فقط برای ingestِ PDF (اختیاری). pdf2image به poppler سیستمی نیاز داره
|
||
# (macOS: brew install poppler). نبودشون فقط endpointِ /api/rag/ingest/pdf
|
||
# رو با خطای صریح از کار میندازه.
|
||
pymupdf==1.28.2
|
||
pdf2image==1.17.0
|
||
pillow==12.3.0
|
||
psycopg[binary]==3.3.6
|
||
# pool اتصالِ Postgres (OPTIONS.pool در config/settings.py). یک بار با pip نصب میشود؛ deploy.sh در
|
||
# دیپلوهای بعد فقط «already satisfied» میگوید.
|
||
psycopg-pool==3.3.3
|