File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ services:
5757 interval : 30s
5858 timeout : 10s
5959 retries : 5
60- start_period : 120s
60+ start_period : 900s
6161 networks :
6262 - docgrid-local
6363
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ psql -d postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'docgrid'" | gre
1414psql -d docgrid -c " CREATE EXTENSION IF NOT EXISTS vector;"
1515
1616# Allow TCP connections from any host (needed for host-machine Spring Boot)
17- grep -qxF " host all all 0.0.0.0/0 trust " " $PGDATA /pg_hba.conf" \
18- || echo " host all all 0.0.0.0/0 trust " >> " $PGDATA /pg_hba.conf"
17+ grep -qxF " host all all 0.0.0.0/0 scram-sha-256 " " $PGDATA /pg_hba.conf" \
18+ || echo " host all all 0.0.0.0/0 scram-sha-256 " >> " $PGDATA /pg_hba.conf"
1919
2020# Stop temp postgres cleanly before handing off
2121pg_ctl stop -D " $PGDATA " -m fast -w
Original file line number Diff line number Diff line change 1+ import threading
12from contextlib import asynccontextmanager
23from fastapi import FastAPI , HTTPException
34from pydantic import BaseModel
910model : BGEM3FlagModel | None = None
1011
1112
12- @asynccontextmanager
13- async def lifespan (app : FastAPI ):
13+ def _load_model ():
1414 global model
1515 logger .info ("Loading BAAI/bge-m3 model..." )
1616 model = BGEM3FlagModel ("BAAI/bge-m3" , use_fp16 = True )
1717 logger .info ("Model loaded." )
18+
19+
20+ @asynccontextmanager
21+ async def lifespan (app : FastAPI ):
22+ thread = threading .Thread (target = _load_model , daemon = True )
23+ thread .start ()
1824 yield
25+ global model
1926 model = None
2027
2128
You can’t perform that action at this time.
0 commit comments