Make PostgreSQL statement_cache_size configuration optional
• Remove forced int conversion
• Allow None values for cache size
• Add conditional parameter setting
(cherry picked from commit f2c0b41e78)
This commit is contained in:
parent
742e6958fe
commit
e0e228673c
1 changed files with 11 additions and 5 deletions
|
|
@ -76,7 +76,9 @@ class PostgreSQLDB:
|
|||
|
||||
# Server settings
|
||||
self.server_settings = config.get("server_settings")
|
||||
self.statement_cache_size = int(config.get("statement_cache_size"))
|
||||
|
||||
# Statement LRU cache size (keep as-is, allow None for optional configuration)
|
||||
self.statement_cache_size = config.get("statement_cache_size")
|
||||
|
||||
if self.user is None or self.password is None or self.database is None:
|
||||
raise ValueError("Missing database user, password, or database")
|
||||
|
|
@ -162,12 +164,16 @@ class PostgreSQLDB:
|
|||
"port": self.port,
|
||||
"min_size": 1,
|
||||
"max_size": self.max,
|
||||
"statement_cache_size": self.statement_cache_size,
|
||||
}
|
||||
|
||||
logger.info(
|
||||
f"PostgreSQL, statement LRU cache size set as: {self.statement_cache_size}"
|
||||
)
|
||||
# Only add statement_cache_size if it's configured
|
||||
if self.statement_cache_size is not None:
|
||||
connection_params["statement_cache_size"] = int(
|
||||
self.statement_cache_size
|
||||
)
|
||||
logger.info(
|
||||
f"PostgreSQL, statement LRU cache size set as: {self.statement_cache_size}"
|
||||
)
|
||||
|
||||
# Add SSL configuration if provided
|
||||
ssl_context = self._create_ssl_context()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue