mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-05 11:26:43 +08:00
move scheduler register place
This commit is contained in:
parent
183f3191e8
commit
d3ef63bf37
@ -17,6 +17,18 @@ scheduler = AsyncIOScheduler(timezone="Asia/Shanghai")
|
||||
|
||||
@get_driver().on_startup
|
||||
async def _start():
|
||||
for platform_name, platform in platform_manager.items():
|
||||
if platform.schedule_type in ["cron", "interval", "date"]:
|
||||
logger.info(
|
||||
f"start scheduler for {platform_name} with {platform.schedule_type} {platform.schedule_kw}"
|
||||
)
|
||||
scheduler.add_job(
|
||||
fetch_and_send,
|
||||
platform.schedule_type,
|
||||
**platform.schedule_kw,
|
||||
args=(platform_name,),
|
||||
)
|
||||
|
||||
scheduler.configure({"apscheduler.timezone": "Asia/Shanghai"})
|
||||
scheduler.start()
|
||||
|
||||
@ -65,19 +77,6 @@ async def fetch_and_send(target_type: str):
|
||||
)
|
||||
|
||||
|
||||
for platform_name, platform in platform_manager.items():
|
||||
if platform.schedule_type in ["cron", "interval", "date"]:
|
||||
logger.info(
|
||||
f"start scheduler for {platform_name} with {platform.schedule_type} {platform.schedule_kw}"
|
||||
)
|
||||
scheduler.add_job(
|
||||
fetch_and_send,
|
||||
platform.schedule_type,
|
||||
**platform.schedule_kw,
|
||||
args=(platform_name,),
|
||||
)
|
||||
|
||||
|
||||
class CustomLogHandler(LoguruHandler):
|
||||
def filter(self, record: logging.LogRecord):
|
||||
return record.msg != (
|
||||
|
Loading…
x
Reference in New Issue
Block a user