添加安装版本统计上报

This commit is contained in:
jxxghp
2026-05-25 18:16:59 +08:00
parent 7ab1a668cb
commit 94633173b1
5 changed files with 151 additions and 0 deletions
+18
View File
@@ -36,6 +36,7 @@ from app.db.systemconfig_oper import SystemConfigOper
from app.helper.image import WallpaperHelper
from app.helper.message import MessageHelper
from app.helper.sites import SitesHelper # noqa
from app.helper.usage import UsageHelper
from app.log import logger
from app.schemas import Notification, NotificationType, Workflow
from app.schemas.types import EventType, SystemConfigKey
@@ -264,6 +265,7 @@ class Scheduler(ConfigReloadMixin, metaclass=SingletonClass):
"DATA_CLEANUP_DOWNLOAD_HISTORY_DAYS",
"DATA_CLEANUP_SITE_USERDATA_DAYS",
"DATA_CLEANUP_TRANSFER_HISTORY_DAYS",
"USAGE_STATISTIC_SHARE",
}
def __init__(self):
@@ -401,6 +403,11 @@ class Scheduler(ConfigReloadMixin, metaclass=SingletonClass):
"func": self.agent_heartbeat,
"running": False,
},
"usage_report": {
"name": "安装版本统计上报",
"func": UsageHelper().report,
"running": False,
},
}
# 创建定时服务
@@ -644,6 +651,17 @@ class Scheduler(ConfigReloadMixin, metaclass=SingletonClass):
kwargs={"job_id": "agent_heartbeat"},
)
# 安装版本统计上报
if settings.USAGE_STATISTIC_SHARE:
self._scheduler.add_job(
self.start,
"interval",
id="usage_report",
name="安装版本统计上报",
hours=24,
kwargs={"job_id": "usage_report"},
)
# 初始化工作流服务
self.init_workflow_jobs()