Implement github issue 1014
Docs: עדכון Connection Pooling ו-HTTP Sessions
מיישם את #1014 – יישור תיעוד ה‑ENV והקונפיגורציה לשדרוגי Pooling ולשימוש ב‑HTTP Sessions.
מה שונה
- ENV: הוספה/הרחבה של פרמטרי Pooling/Timeouts עבור MongoDB, Redis, aiohttp ו‑requests (כולל
SAFE_MODE). - HTTP Sync: תיעוד המודול
http_sync.pyושימוש ב‑requests.Sessionגלובלי עםHTTPAdapterו‑Retries. - .env: דוגמאות קצרות ל‑Dev/Staging/Prod, כולל הערת Docker (שימוש ב‑service names ולא ב‑localhost).
- Performance: הנחיות כוונון (tuning) ופרק “בדיקות מהירות” לאחר שינוי ENV.
עמודים שעודכנו
docs/environment-variables.rstdocs/configuration.rstdocs/performance-scaling.rst
דוגמת .env (תמציתי)
# Redis
CACHE_ENABLED=true
REDIS_URL=redis://redis:6379/0
REDIS_MAX_CONNECTIONS=100
REDIS_CONNECT_TIMEOUT=2.0
REDIS_SOCKET_TIMEOUT=3.0
SAFE_MODE=false
MongoDB
MONGODB_URL=mongodb://mongo:27017
DATABASE_NAME=code_keeper_bot
MONGODB_MAX_POOL_SIZE=100
MONGODB_MIN_POOL_SIZE=5
MONGODB_MAX_IDLE_TIME_MS=30000
MONGODB_WAIT_QUEUE_TIMEOUT_MS=5000
MONGODB_SERVER_SELECTION_TIMEOUT_MS=5000
MONGODB_SOCKET_TIMEOUT_MS=30000
MONGODB_CONNECT_TIMEOUT_MS=10000
MONGODB_RETRY_WRITES=true
MONGODB_RETRY_READS=true
MONGODB_APPNAME=CodeBot
aiohttp
AIOHTTP_POOL_LIMIT=100
AIOHTTP_LIMIT_PER_HOST=25
AIOHTTP_TIMEOUT_TOTAL=15
requests (http_sync)
REQUESTS_POOL_CONNECTIONS=20
REQUESTS_POOL_MAXSIZE=100
REQUESTS_TIMEOUT=8
REQUESTS_RETRIES=2
REQUESTS_RETRY_BACKOFF=0.2
מדוע
לספק תיעוד מעודכן, ברור ואחיד לשדרוגי Pooling/Timeouts ולשימוש ב‑Sessions (async/sync), כדי לשפר יציבות וביצועים ולהקל על כוונון לפי סביבה.
תוכנית בדיקות
- התקנת תלויות דוקס:
pip install -r docs/requirements.txt - בנייה מקומית עם אזהרות כשגיאות:
sphinx-build -b html docs docs/_build/html -W --keep-going - מעבר ידני על העמודים המעודכנים לאימות קישורים, טבלאות וקטעי
.env.
קריטריוני מעבר
- בנייה עוברת ללא אזהרות.
- עמודי התיעוד נטענים תקין והקישורים פנימיים עובדים.
סיכונים ו-Rollback
- סיכון נמוך (שינויי תיעוד בלבד). Rollback: החזרת קבצי RST לקודמתם.
קישורים
- CodeBot – Project Docs
- Issue: #1014
[!NOTE]
Expands docs to cover MongoDB/Redis pooling and timeouts, HTTP client configuration (async/sync), new env vars, and performance-scaling guidance.
- Docs:
docs/configuration.rst:
- Add sections for databases/cache pooling and timeouts (
MONGODB_*, REDIS_*, SAFE_MODE).
- Document HTTP clients: aiohttp (
AIOHTTP_*) and sync http_sync with example and env-based pooling/retries.
- Clarify Redis TLS note and Docker/Compose service hostnames.
docs/environment-variables.rst:
- Expand reference table with MongoDB pooling/timeouts (
MONGODB_MAX_POOL_SIZE, ..., MONGODB_APPNAME).
- Add Redis and HTTP client knobs:
REDIS_MAX_CONNECTIONS, REDIS_CONNECT_TIMEOUT, REDIS_SOCKET_TIMEOUT, SAFE_MODE, AIOHTTP_LIMIT_PER_HOST, REQUESTS_POOL_*, REQUESTS_TIMEOUT, REQUESTS_RETRIES, REQUESTS_RETRY_BACKOFF.
docs/performance-scaling.rst:
- Add tuning guidance for MongoDB/Redis/aiohttp/requests pooling and timeouts.
- Include post-change benchmarking/metrics checklist and environment-specific recommendations.
Written by Cursor Bugbot for commit bfac8839d2a3c61fd9e1285789ff9fad268b1f97. This will update automatically on new commits. Configure here.