Merge branch 'pg-max-connection'
This commit is contained in:
@@ -20,3 +20,4 @@ user = your_username
|
|||||||
password = your_password
|
password = your_password
|
||||||
database = your_database
|
database = your_database
|
||||||
workspace = default # 可选,默认为default
|
workspace = default # 可选,默认为default
|
||||||
|
max_connections = 12
|
||||||
|
@@ -131,6 +131,7 @@ POSTGRES_PORT=5432
|
|||||||
POSTGRES_USER=your_username
|
POSTGRES_USER=your_username
|
||||||
POSTGRES_PASSWORD='your_password'
|
POSTGRES_PASSWORD='your_password'
|
||||||
POSTGRES_DATABASE=your_database
|
POSTGRES_DATABASE=your_database
|
||||||
|
POSTGRES_MAX_CONNECTIONS=12
|
||||||
### separating all data from difference Lightrag instances(deprecating)
|
### separating all data from difference Lightrag instances(deprecating)
|
||||||
# POSTGRES_WORKSPACE=default
|
# POSTGRES_WORKSPACE=default
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ class PostgreSQLDB:
|
|||||||
self.password = config.get("password", None)
|
self.password = config.get("password", None)
|
||||||
self.database = config.get("database", "postgres")
|
self.database = config.get("database", "postgres")
|
||||||
self.workspace = config.get("workspace", "default")
|
self.workspace = config.get("workspace", "default")
|
||||||
self.max = 12
|
self.max = int(config.get("max_connections", 12))
|
||||||
self.increment = 1
|
self.increment = 1
|
||||||
self.pool: Pool | None = None
|
self.pool: Pool | None = None
|
||||||
|
|
||||||
@@ -312,6 +312,10 @@ class ClientManager:
|
|||||||
"POSTGRES_WORKSPACE",
|
"POSTGRES_WORKSPACE",
|
||||||
config.get("postgres", "workspace", fallback="default"),
|
config.get("postgres", "workspace", fallback="default"),
|
||||||
),
|
),
|
||||||
|
"max_connections": os.environ.get(
|
||||||
|
"POSTGRES_MAX_CONNECTIONS",
|
||||||
|
config.get("postgres", "max_connections", fallback=12),
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Reference in New Issue
Block a user