task: add send common mail task
All checks were successful
Gitea Actions Demo / deploy (push) Successful in 11s
All checks were successful
Gitea Actions Demo / deploy (push) Successful in 11s
This commit is contained in:
9
arlo.py
9
arlo.py
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user