Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat]: Plugin 在 initialize 生命周期实现异步非堵塞运行 #459

Closed
4 tasks done
luoshuijs opened this issue Mar 7, 2023 · 0 comments · Fixed by #344
Closed
4 tasks done

[Feat]: Plugin 在 initialize 生命周期实现异步非堵塞运行 #459

luoshuijs opened this issue Mar 7, 2023 · 0 comments · Fixed by #344
Assignees

Comments

@luoshuijs
Copy link
Contributor

请确保您已阅读以上注意事项,并勾选下方的确认框。

  • 我确定这是一个从未被提出和实现过的功能。
  • 我已经在 Issue Tracker 以及 Pull Request 中找过我要提出的功能,没有找到相同功能的ISSUE和PR。
  • 我已知晓并同意,此处仅用于建议新功能。若这个 Issue 是关于其他非主题的问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。
  • 我已知晓并同意,如果我不按照模板提供的指示进行填写,则我的 Issue 可能会被无条件删除。

需要添加的功能内容

在 Plugin 生命周期 initialize 实现异步运行加快加载速度

await self.initialize()

async def initialize_task(self):
    try:
        await self.initialize() 
    expect except Exception as e:  # pylint: disable=W0703
        logger.error('插件 "%s" initialize 过程失败', f"self.__name__", exc_info=e)

async def install(self) -> None:
    # L198
    await asyncio.creat_task(self.initialize_task)
@luoshuijs luoshuijs self-assigned this Mar 7, 2023
@luoshuijs luoshuijs moved this to 🔖 Ready in PaiGram V4 Mar 9, 2023
@luoshuijs luoshuijs linked a pull request Mar 9, 2023 that will close this issue
15 tasks
@luoshuijs luoshuijs moved this from 🔖 Ready to ✅ Done in PaiGram V4 Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant