Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

refine db connection (#1494)

Kevin Hu26de9adb418a
diff --git a/api/db/db_models.py b/api/db/db_models.py
index 033a966884..4491526bf3 100644
--- a/api/db/db_models.py
+++ b/api/db/db_models.py
@@ -332,7 +332,7 @@ DB.lock = DatabaseLock
def close_connection():
try:
if DB:
- DB.close()
+ DB.close_stale(age=30)
except Exception as e:
LOGGER.exception(e)
diff --git a/api/ragflow_server.py b/api/ragflow_server.py
index a4e5b77154..8878817a34 100644
--- a/api/ragflow_server.py
+++ b/api/ragflow_server.py
@@ -94,7 +94,7 @@ if __name__ == '__main__':
werkzeug_logger = logging.getLogger("werkzeug")
for h in access_logger.handlers:
werkzeug_logger.addHandler(h)
- run_simple(hostname=HOST, port=HTTP_PORT, application=app, processes=5, use_reloader=RuntimeConfig.DEBUG, use_debugger=RuntimeConfig.DEBUG)
+ run_simple(hostname=HOST, port=HTTP_PORT, application=app, threaded=True, use_reloader=RuntimeConfig.DEBUG, use_debugger=RuntimeConfig.DEBUG)
except Exception:
traceback.print_exc()
os.kill(os.getpid(), signal.SIGKILL)
\ No newline at end of file
diff --git a/rag/llm/__init__.py b/rag/llm/__init__.py
index 3fdab822d8..50b541f417 100644
--- a/rag/llm/__init__.py
+++ b/rag/llm/__init__.py
@@ -33,7 +33,7 @@ EmbeddingModel = {
"BAAI": DefaultEmbedding,
"Mistral": MistralEmbed,
"Bedrock": BedrockEmbed,
- "Gemini":GeminiEmbed,
+ "Gemini":GeminiEmbed
}