Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: fix db env not work (#30541)

wangxiaoleie3e19c437ae0
diff --git a/api/extensions/ext_database.py b/api/extensions/ext_database.py
index c90b1d0a9fc..2e0d4c889ae 100644
--- a/api/extensions/ext_database.py
+++ b/api/extensions/ext_database.py
@@ -53,3 +53,10 @@ def _setup_gevent_compatibility():
def init_app(app: DifyApp):
db.init_app(app)
_setup_gevent_compatibility()
+
+ # Eagerly build the engine so pool_size/max_overflow/etc. come from config
+ try:
+ with app.app_context():
+ _ = db.engine # triggers engine creation with the configured options
+ except Exception:
+ logger.exception("Failed to initialize SQLAlchemy engine during app startup")