File size: 560 Bytes
47ff6b2
 
 
e51f7f4
 
47ff6b2
e51f7f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import uvicorn
from app.core.config import settings

import os

if __name__ == "__main__":
    print(f"🚀 Starting optimized {settings.PROJECT_NAME}...")
    # Scaling to multiple workers to handle concurrent attendance requests 
    # (Memory allowing - ArcFace is ~20MB so 4 workers is safe)
    cpu_count = os.cpu_count() or 1
    worker_count = min(4, cpu_count)
    
    uvicorn.run(
        "app.main:app", 
        host="0.0.0.0", 
        port=8000, 
        reload=False, 
        workers=worker_count,
        loop="auto",
        http="h11"
    )