refactor(performance): complete connection pool migration for remaining repositories
- Update UserRepository to use connection pool - Update WorkspaceRepository to use connection pool - All 5 PostgreSQL repositories now use connection pool - Complete performance optimization across all database operations Phase 4 Task 41/68 fully completed
This commit is contained in:
@@ -17,8 +17,9 @@ class PostgresUserRepository(UserRepository):
|
||||
self.connection_string = connection_string
|
||||
|
||||
def _get_connection(self):
|
||||
"""获取数据库连接"""
|
||||
return psycopg2.connect(self.connection_string, cursor_factory=RealDictCursor)
|
||||
"""获取数据库连接(使用连接池)"""
|
||||
from packages.adapters.postgres.connection_pool import PooledConnection
|
||||
return PooledConnection()
|
||||
|
||||
def save(self, user: User) -> None:
|
||||
"""保存用户"""
|
||||
|
||||
@@ -16,8 +16,9 @@ class PostgresWorkspaceRepository(WorkspaceRepository):
|
||||
self.connection_string = connection_string
|
||||
|
||||
def _get_connection(self):
|
||||
"""获取数据库连接"""
|
||||
return psycopg2.connect(self.connection_string, cursor_factory=RealDictCursor)
|
||||
"""获取数据库连接(使用连接池)"""
|
||||
from packages.adapters.postgres.connection_pool import PooledConnection
|
||||
return PooledConnection()
|
||||
|
||||
def save(self, workspace: Workspace) -> None:
|
||||
"""保存工作空间"""
|
||||
|
||||
Reference in New Issue
Block a user