fix db session
This commit is contained in:
@@ -5,7 +5,6 @@ from typing import Any, List, Dict, Tuple
|
||||
from app.chain import ChainBase
|
||||
from app.core.config import settings
|
||||
from app.core.event import EventManager
|
||||
from app.db import SessionFactory
|
||||
from app.db.models import Base
|
||||
from app.db.plugindata_oper import PluginDataOper
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
@@ -36,12 +35,10 @@ class _PluginBase(metaclass=ABCMeta):
|
||||
plugin_desc: str = ""
|
||||
|
||||
def __init__(self):
|
||||
# 数据库连接
|
||||
self.db = SessionFactory()
|
||||
# 插件数据
|
||||
self.plugindata = PluginDataOper(self.db)
|
||||
self.plugindata = PluginDataOper()
|
||||
# 处理链
|
||||
self.chain = PluginChian(self.db)
|
||||
self.chain = PluginChian()
|
||||
# 系统配置
|
||||
self.systemconfig = SystemConfigOper()
|
||||
# 系统消息
|
||||
@@ -186,8 +183,4 @@ class _PluginBase(metaclass=ABCMeta):
|
||||
))
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
关闭数据库连接
|
||||
"""
|
||||
if self.db:
|
||||
self.db.close()
|
||||
pass
|
||||
|
Reference in New Issue
Block a user