maharjun commited on
Commit
4962ca7
·
1 Parent(s): 3e5668f

Allow max_connections to be configured in postgres

Browse files
config.ini.example CHANGED
@@ -20,3 +20,4 @@ user = your_username
20
  password = your_password
21
  database = your_database
22
  workspace = default # 可选,默认为default
 
 
20
  password = your_password
21
  database = your_database
22
  workspace = default # 可选,默认为default
23
+ max_connections = 12
lightrag/kg/postgres_impl.py CHANGED
@@ -54,7 +54,7 @@ class PostgreSQLDB:
54
  self.password = config.get("password", None)
55
  self.database = config.get("database", "postgres")
56
  self.workspace = config.get("workspace", "default")
57
- self.max = 12
58
  self.increment = 1
59
  self.pool: Pool | None = None
60
 
@@ -250,6 +250,10 @@ class ClientManager:
250
  "POSTGRES_WORKSPACE",
251
  config.get("postgres", "workspace", fallback="default"),
252
  ),
 
 
 
 
253
  }
254
 
255
  @classmethod
 
54
  self.password = config.get("password", None)
55
  self.database = config.get("database", "postgres")
56
  self.workspace = config.get("workspace", "default")
57
+ self.max = config.get("max_connections", 12)
58
  self.increment = 1
59
  self.pool: Pool | None = None
60
 
 
250
  "POSTGRES_WORKSPACE",
251
  config.get("postgres", "workspace", fallback="default"),
252
  ),
253
+ "max_connections": os.environ.get(
254
+ "POSTGRES_MAX_CONNECTIONS",
255
+ config.get("postgres", "max_connections", fallback=12),
256
+ ),
257
  }
258
 
259
  @classmethod