From 9408102a827afc2fa03c0fa6f3a6309b51144675 Mon Sep 17 00:00:00 2001 From: omg-xtao <100690902+omg-xtao@users.noreply.github.com> Date: Mon, 24 Jul 2023 20:27:49 +0800 Subject: [PATCH] :bug: Fix daily note task timeout --- plugins/jobs/birthday_card.py | 2 +- plugins/tools/daily_note.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/jobs/birthday_card.py b/plugins/jobs/birthday_card.py index 6322b66b..e7518297 100644 --- a/plugins/jobs/birthday_card.py +++ b/plugins/jobs/birthday_card.py @@ -13,7 +13,7 @@ class CardJob(Plugin): def __init__(self, card_system: BirthdayCardSystem): self.card_system = card_system - @job.run_daily(time=datetime.time(hour=0, minute=1, second=0), name="CardJob") + @job.run_daily(time=datetime.time(hour=0, minute=23, second=0), name="CardJob") async def card(self, context: "ContextTypes.DEFAULT_TYPE"): logger.info("正在执行自动领取生日画片") await self.card_system.do_get_card_job(context) diff --git a/plugins/tools/daily_note.py b/plugins/tools/daily_note.py index 1ca4d35d..a3314780 100644 --- a/plugins/tools/daily_note.py +++ b/plugins/tools/daily_note.py @@ -307,6 +307,7 @@ class DailyNoteSystem(Plugin): if task_db.status not in include_status: continue user_id = task_db.user_id + logger.info("自动便签提醒 - 请求便签信息 user_id[%s]", user_id) try: async with self.genshin_helper.genshin(user_id) as client: text = await self.start_get_notes(client, task_db) @@ -319,8 +320,8 @@ class DailyNoteSystem(Plugin): text = f"自动便签提醒执行失败,API返回信息为 {str(exc)}" task_db.status = TaskStatusEnum.GENSHIN_EXCEPTION except SimnetTimedOut: - text = "便签获取失败了呜呜呜 ~ 服务器连接超时 服务器熟啦 ~ " - task_db.status = TaskStatusEnum.TIMEOUT_ERROR + logger.info("用户 user_id[%s] 请求便签超时", user_id) + continue except PlayerNotFoundError: logger.info("用户 user_id[%s] 玩家不存在 关闭并移除自动便签提醒", user_id) await self.remove_task_user(task_db)