Merge branch 'master' of https://gitea.tatta.cn/Tatta/TaskPulse
This commit is contained in:
@@ -38,6 +38,7 @@ class AgentService:
|
||||
if v is not None and hasattr(agent, k):
|
||||
setattr(agent, k, v)
|
||||
await self.db.flush()
|
||||
await self.db.refresh(agent)
|
||||
return agent
|
||||
|
||||
async def heartbeat(self, agent_id: int) -> Agent | None:
|
||||
@@ -46,6 +47,7 @@ class AgentService:
|
||||
if agent:
|
||||
agent.last_heartbeat_at = datetime.utcnow()
|
||||
await self.db.flush()
|
||||
await self.db.refresh(agent)
|
||||
return agent
|
||||
|
||||
async def get_task_count(self, agent_id: int) -> int:
|
||||
|
||||
@@ -10,6 +10,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from app.config import settings
|
||||
from app.database import async_session_factory
|
||||
from app.models import ScheduledTask, Alert, AlertRule, NotificationChannel
|
||||
from app.utils import fmt_bj
|
||||
|
||||
logger = logging.getLogger("taskpulse.scheduler")
|
||||
|
||||
@@ -66,9 +67,9 @@ class SchedulerService:
|
||||
alert_type="missed_run",
|
||||
message=(
|
||||
f"任务 [{task.name}](ID={task.id}) 超过预定时间未执行。\n"
|
||||
f"预期执行时间: {task.next_run_at}\n"
|
||||
f"预期执行时间: {fmt_bj(task.next_run_at)}\n"
|
||||
f"容忍窗口: {task.grace_period}s\n"
|
||||
f"当前时间: {now}"
|
||||
f"当前时间: {fmt_bj(now)}"
|
||||
),
|
||||
status="pending",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user