fix: SSE timeout during social proof collection

Ne yaptık:
- time.sleep() → await asyncio.sleep() ile event loop bloklanması engellendi
- Sosyal kanıt batch size 5 → 20 (1115 istek → 279 istek, %75 azalma)
- SSE keepalive heartbeat eklendi (her 10 batch'te bir)
- Nginx proxy timeout 180s → 600s (10 dakika)
- Rate limit sleep süreleri optimize edildi (2s→1.5s, 0.5s→0.3s)

Neden yaptık:
- Kadın kategorisi gibi büyük raporlarda (82 yaprak kategori, 5576 ürün)
  sosyal kanıt aşamasında SSE bağlantısı kopuyordu. Kök neden:
  senkron time.sleep() async generator içinde event loop'u blokluyor,
  proxy idle timeout'a takılıyor ve bağlantıyı kesiyordu.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
furkanyigit34
2026-03-27 17:01:14 +03:00
parent f5562e2135
commit dc1f8fcfb2
2 changed files with 9 additions and 7 deletions

View File

@@ -37,8 +37,8 @@ server {
# Timeouts for long-running operations
proxy_connect_timeout 60s;
proxy_send_timeout 180s;
proxy_read_timeout 180s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
# Disable buffering for streaming responses
proxy_buffering off;