Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions reflex/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,18 @@ class EnvironmentVariables:
# Whether to check db connections before using them.
SQLALCHEMY_POOL_PRE_PING: EnvVar[bool] = env_var(True)

# The size of the database connection pool.
SQLALCHEMY_POOL_SIZE: EnvVar[int] = env_var(5)

# The maximum overflow size of the database connection pool.
SQLALCHEMY_MAX_OVERFLOW: EnvVar[int] = env_var(10)

# Recycle connections after this many seconds.
SQLALCHEMY_POOL_RECYCLE: EnvVar[int] = env_var(-1)

# The timeout for acquiring a connection from the pool.
SQLALCHEMY_POOL_TIMEOUT: EnvVar[int] = env_var(30)

# Whether to ignore the redis config error. Some redis servers only allow out-of-band configuration.
REFLEX_IGNORE_REDIS_CONFIG_ERROR: EnvVar[bool] = env_var(False)

Expand Down
4 changes: 4 additions & 0 deletions reflex/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def get_engine_args(url: str | None = None) -> dict[str, Any]:
"echo": environment.SQLALCHEMY_ECHO.get(),
# Check connections before returning them.
"pool_pre_ping": environment.SQLALCHEMY_POOL_PRE_PING.get(),
"pool_size": environment.SQLALCHEMY_POOL_SIZE.get(),
"max_overflow": environment.SQLALCHEMY_MAX_OVERFLOW.get(),
"pool_recycle": environment.SQLALCHEMY_POOL_RECYCLE.get(),
"pool_timeout": environment.SQLALCHEMY_POOL_TIMEOUT.get(),
}
conf = get_config()
url = url or conf.db_url
Expand Down
Loading