mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-12-01 01:25:07 +08:00
Move scheduler staring to Quart's before serving hook
This commit is contained in:
parent
bfba4d1bd4
commit
c1486ebbbe
@ -75,9 +75,14 @@ def init(config_object: Optional[Any] = None) -> None:
|
|||||||
else:
|
else:
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
|
_bot.server_app.before_serving(_start_scheduler)
|
||||||
|
|
||||||
|
|
||||||
|
def _start_scheduler():
|
||||||
if scheduler and not scheduler.running:
|
if scheduler and not scheduler.running:
|
||||||
scheduler.configure(_bot.config.APSCHEDULER_CONFIG)
|
scheduler.configure(_bot.config.APSCHEDULER_CONFIG)
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
logger.info('Scheduler started')
|
||||||
|
|
||||||
|
|
||||||
def get_bot() -> NoneBot:
|
def get_bot() -> NoneBot:
|
||||||
|
Loading…
Reference in New Issue
Block a user