When the beta image runs with --workers > 1 (default: 2), every worker calls lifespan() in parallel. Each worker sees an empty DB, then seed_if_empty() runs concurrently, producing 2x (or Nx) demo entries. Fix: wrap the seed operation in a process-wide FileLock. Even if a worker loses the race it re-checks the table count inside the critical section and returns without re-seeding. Verified by cold-starting a 4-worker container: 8 items (was: 32).
9 lines
148 B
Plaintext
9 lines
148 B
Plaintext
fastapi==0.115.0
|
|
uvicorn[standard]==0.30.6
|
|
SQLAlchemy==2.0.35
|
|
pydantic==2.9.2
|
|
httpx==0.27.2
|
|
python-multipart==0.0.10
|
|
jinja2==3.1.4
|
|
filelock==3.16.1
|