mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-04 02:26:11 +08:00
✨ 尝试添加一种可以跳过当前请求的方式
This commit is contained in:
parent
16331b50d5
commit
b25fcd9ac2
@ -12,6 +12,7 @@ from ..send import send_msgs
|
|||||||
from ..types import Target, SubUnit
|
from ..types import Target, SubUnit
|
||||||
from ..platform import platform_manager
|
from ..platform import platform_manager
|
||||||
from ..utils import Site, ProcessContext
|
from ..utils import Site, ProcessContext
|
||||||
|
from ..utils.site import SkipRequestException
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -107,6 +108,8 @@ class Scheduler:
|
|||||||
schedulable.platform_name, schedulable.target
|
schedulable.platform_name, schedulable.target
|
||||||
)
|
)
|
||||||
to_send = await platform_obj.do_fetch_new_post(SubUnit(schedulable.target, send_userinfo_list))
|
to_send = await platform_obj.do_fetch_new_post(SubUnit(schedulable.target, send_userinfo_list))
|
||||||
|
except SkipRequestException as err:
|
||||||
|
logger.debug(f"skip request: {err}")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
records = context.gen_req_records()
|
records = context.gen_req_records()
|
||||||
for record in records:
|
for record in records:
|
||||||
|
@ -173,3 +173,7 @@ def anonymous_site(schedule_type: Literal["date", "interval", "cron"], schedule_
|
|||||||
"client_mgr": DefaultClientManager,
|
"client_mgr": DefaultClientManager,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SkipRequestException(Exception):
|
||||||
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user