Spaces:
Running

microfunnel-api / backend /scripts /verify_scaling.py
axeronis
perf: optimize system for high concurrency (100+ dialogues)
bbf53ef
Raw History Blame Contribute Delete
1.24 kB
import asyncio
import sys
import os
# Add project root to sys.path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
# Mock settings before importing app
os.environ["DATABASE_URL"] = "postgresql://user:pass@localhost/db"
os.environ["SUPABASE_URL"] = "https://test.supabase.co"
os.environ["SUPABASE_KEY"] = "test"
os.environ["SECRET_KEY"] = "test_secret_key_long_enough_32_chars_"
os.environ["GROQ_API_KEY"] = "test" * 20
from app.services.ai_queue import get_ai_queue
from app.services.voice_service import voice_service
async def test_limits():
print("--- SCALING CONFIGURATION VERIFICATION ---")
# 1. Check AI Queue
queue = get_ai_queue()
print(f"AI Queue Max RPM: {queue.max_rpm}")
print(f"AI Queue Max Concurrent: {queue.max_concurrent}")
# 2. Check Voice Semaphore
print(f"Voice Semaphore Limit: {voice_service.semaphore._value}")
# 3. Check DB config from database.py manually since we can't easily check pool size without engine
from app.core.database import async_engine
print(f"DB Pool Size Config: {async_engine.pool.size()}")
print("\n✅ Scaling configurations verified.")
if __name__ == "__main__":
asyncio.run(test_limits())