Skip to content

Commit f4a6cd5

Browse files
kangcheolungclaude
andcommitted
fix: CodeRabbit 리뷰 반영 - healthcheck start_period 증가, pg_hba.conf scram-sha-256 적용, 모델 백그라운드 로드
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 676b376 commit f4a6cd5

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

docker/opensql/init-and-start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ psql -d postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'docgrid'" | gre
1414
psql -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
2121
pg_ctl stop -D "$PGDATA" -m fast -w

embedding-server/main.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import threading
12
from contextlib import asynccontextmanager
23
from fastapi import FastAPI, HTTPException
34
from pydantic import BaseModel
@@ -9,13 +10,19 @@
910
model: 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

0 commit comments

Comments
 (0)