task: add send common mail task
All checks were successful
Gitea Actions Demo / deploy (push) Successful in 11s

This commit is contained in:
konjacpotato
2026-02-15 15:53:48 +08:00
parent 200550b4f8
commit 5c3c429620
19 changed files with 334 additions and 6 deletions

View File

@ -7,7 +7,6 @@ include exception tracebacks for easier debugging.
import datetime
import signal
import sys
import traceback
from functools import partial
from typing import Any
@ -16,8 +15,8 @@ from apscheduler.events import EVENT_JOB_ERROR
from apscheduler.schedulers.blocking import BlockingScheduler
from config import config
from log.log_manager import log, logger
from task.manager_task import manager_task
from utils import logger
def _format_exception(exc: BaseException) -> str:
@ -84,7 +83,7 @@ def main() -> None:
# Graceful shutdown handlers
def _shutdown(signum, frame):
log(f"Received signal {signum}. Shutting down scheduler...")
logger.info(f"Received signal {signum}. Shutting down scheduler...")
try:
scheduler.shutdown(wait=False)
except Exception:
@ -96,10 +95,10 @@ def main() -> None:
signal.signal(signal.SIGTERM, _shutdown)
try:
log("started successfully.")
logger.info("started successfully.")
scheduler.start() # 阻塞运行
except (KeyboardInterrupt, SystemExit):
log("Shutting down ...")
logger.info("Shutting down ...")
if scheduler.state == 1:
try:
scheduler.shutdown(wait=False)