gzdaniel commited on
Commit
cc16b89
·
2 Parent(s): 3672d8b 66081f1

Merge branch 'allow_max_connection_config' into pg-max-connection

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
@@ -55,7 +55,7 @@ class PostgreSQLDB:
55
  self.password = config.get("password", None)
56
  self.database = config.get("database", "postgres")
57
  self.workspace = config.get("workspace", "default")
58
- self.max = 12
59
  self.increment = 1
60
  self.pool: Pool | None = None
61
 
@@ -312,6 +312,10 @@ class ClientManager:
312
  "POSTGRES_WORKSPACE",
313
  config.get("postgres", "workspace", fallback="default"),
314
  ),
 
 
 
 
315
  }
316
 
317
  @classmethod
 
55
  self.password = config.get("password", None)
56
  self.database = config.get("database", "postgres")
57
  self.workspace = config.get("workspace", "default")
58
+ self.max = int(config.get("max_connections", 12))
59
  self.increment = 1
60
  self.pool: Pool | None = None
61
 
 
312
  "POSTGRES_WORKSPACE",
313
  config.get("postgres", "workspace", fallback="default"),
314
  ),
315
+ "max_connections": os.environ.get(
316
+ "POSTGRES_MAX_CONNECTIONS",
317
+ config.get("postgres", "max_connections", fallback=12),
318
+ ),
319
  }
320
 
321
  @classmethod