数据库管理器单例模式
This commit is contained in:
@@ -51,7 +51,7 @@ class StatsCollectorPlugin(PluginInterface):
|
||||
}
|
||||
|
||||
self.event_manager = EventManager.get_instance()
|
||||
self.db_manager = DBConnectionManager()
|
||||
self.db_manager = DBConnectionManager.get_instance()
|
||||
self.stats_db = StatsDBOperator(self.db_manager)
|
||||
|
||||
def initialize(self, config: Dict[str, Any]) -> bool:
|
||||
|
||||
@@ -21,7 +21,7 @@ class DashboardServer:
|
||||
self.logger = logging.getLogger("DashboardServer")
|
||||
|
||||
# 修正:使用单例模式获取数据库连接
|
||||
self.db_manager = DBConnectionManager()
|
||||
self.db_manager = DBConnectionManager.get_instance()
|
||||
self.stats_db = StatsDBOperator(self.db_manager)
|
||||
self.app = self._create_app()
|
||||
self._stop_event = threading.Event()
|
||||
|
||||
Reference in New Issue
Block a user