Skip to content

Commit 43463fe

Browse files
authored
fix: Pause after starting populate_rag_db_thread (#147)
1 parent 8e83075 commit 43463fe

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

app/gunicorn.conf.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import os
1313
import threading
14+
import time
1415

1516
from src.app_config import config as app_config
1617
from src.ingestion import rag_utils
@@ -29,5 +30,14 @@
2930
# https://stackoverflow.com/questions/24101724/gunicorn-with-multiple-workers-is-there-an-easy-way-to-execute-certain-code-onl
3031
def when_ready(server: object) -> None:
3132
print("when_ready()", server)
33+
34+
print("populate_vector_db()")
3235
populate_rag_db_thread = threading.Thread(target=rag_utils.populate_vector_db)
3336
populate_rag_db_thread.start()
37+
38+
# Not sure why this is needed but without this sleep,
39+
# pipelines can get stuck on "Running component retriever".
40+
# Hypothesis: There's some initialization that is presenting a race condition.
41+
time.sleep(4)
42+
43+
print("when_ready() Done")

0 commit comments

Comments
 (0)