mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-04 03:10:01 +08:00
* bugfix:修复notice事件扩散问题 * 优化并发调度 * bugfix:修复签到样式 * bugfix:功能调用统计修复 * bugfix:修复私聊时功能调用统计显示已退群问题 * 提高插件适配兼容性 * 优化发送队列 * 修改权限检查设计 * 继续修改权限检查设计 * 完善权限检查设计 * 优化sqlite配置 * 优化数据库初始化 * 代码整理,无用代码清理 * bugfix:修复启动时数据库校验问题 * bugfix:修复预算裁剪过于激进问题
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from typing import ClassVar
|
|
|
|
from tortoise import fields
|
|
|
|
from zhenxun.services.db_context import Model
|
|
|
|
|
|
class RuntimeBackpressureLog(Model):
|
|
id = fields.IntField(pk=True, generated=True, auto_increment=True)
|
|
"""自增id"""
|
|
scope_key = fields.CharField(255, null=True, description="作用域")
|
|
"""作用域"""
|
|
reason = fields.CharField(255, null=True, description="原因")
|
|
"""原因"""
|
|
lane = fields.CharField(64, null=True, description="调度通道")
|
|
"""调度通道"""
|
|
action = fields.CharField(64, description="处理动作")
|
|
"""处理动作 execute/skip/defer/signal"""
|
|
queue_size = fields.IntField(default=0, description="队列长度")
|
|
"""队列长度"""
|
|
active_count = fields.IntField(default=0, description="活跃数量")
|
|
"""活跃数量"""
|
|
duration_ms = fields.FloatField(default=0, description="持续耗时毫秒")
|
|
"""持续耗时毫秒"""
|
|
create_time = fields.DatetimeField(auto_now_add=True, description="创建时间")
|
|
"""创建时间"""
|
|
|
|
class Meta: # pyright: ignore [reportIncompatibleVariableOverride]
|
|
table = "runtime_backpressure_log"
|
|
table_description = "运行时背压追加审计日志"
|
|
indexes: ClassVar = [
|
|
("create_time",),
|
|
("scope_key", "create_time"),
|
|
("lane", "create_time"),
|
|
]
|
|
|
|
@classmethod
|
|
async def _run_script(cls):
|
|
return []
|