Skip to content

使用的时候不是很及时经常报超时错误 #5

@lintonxue00

Description

@lintonxue00

[PyBot][10:44:30.224][ERROR] [message]Running Matcher(type='message', module=nonebot_plugin_reborn) failed.
Traceback (most recent call last):
File "/root/Yunzai-Bot/plugins/py-plugin/main.py", line 17, in
yunzai_nonebot.run()
File "/root/Yunzai-Bot/plugins/py-plugin/yunzai_nonebot/init.py", line 31, in run
nonebot.run(*args, **kwargs)
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/init.py", line 273, in run
get_driver().run(*args, **kwargs)
File "/root/Yunzai-Bot/plugins/py-plugin/yunzai_nonebot/hijack/driver.py", line 42, in run
loop.run_until_complete(self.serve())
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 634, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 601, in run_forever
self._run_once()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1905, in _run_once
handle._run()
File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/root/Yunzai-Bot/plugins/py-plugin/yunzai_nonebot/hijack/message.py", line 10, in wrapper
return await func(*args, **kwargs)
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 141, in _check_matcher
await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 187, in _run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 732, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 707, in simple_run
await handler(
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/dependencies/init.py", line 108, in call
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot_plugin_reborn/init.py", line 124, in _
await page.set_content(chart_html)
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/playwright/async_api/_generated.py", line 9107, in set_content
await self._impl_obj.set_content(
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/playwright/_impl/_page.py", line 486, in set_content
return await self._main_frame.set_content(**locals_to_params(locals()))
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/playwright/_impl/_frame.py", line 423, in set_content
await self._channel.send("setContent", locals_to_params(locals()))
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/playwright/_impl/_connection.py", line 61, in send
return await self._connection.wrap_api_call(
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/playwright/_impl/_connection.py", line 461, in wrap_api_call
return await cb()
File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/playwright/_impl/_connection.py", line 96, in inner_send
result = next(iter(done)).result()
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
setting frame content, waiting until "load"
============================================================分析报错原因

3 / 3

根据报错信息可以看到,错误信息主要涉及到使用 nonebot_plugin_reborn 插件在设置页面内容时出现了超时错误 playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.。

具体来说,在执行 await page.set_content(chart_html) 时出现了问题,超时时间为30秒。根据错误信息,我们可以推测问题可能出在以下几个方面:

页面的加载速度过慢,导致设置页面内容的操作超时。
网络连接不稳定,导致页面内容无法正确加载。
代码实现有误,导致在执行 await page.set_content(chart_html) 时出现错误。
针对这些可能的原因,我们可以分别采取以下措施:

对于页面加载速度过慢的情况,可以尝试优化页面结构、减少资源加载等方式来提高页面加载速度。
对于网络连接不稳定的情况,可以尝试检查网络连接是否正常,或者在代码中设置一定的重试机制来解决网络连接问题。
对于代码实现有误的情况,可以检查代码逻辑是否正确,或者参考官方文档等资源来修正代码实现。
综合来说,根据具体的情况,我们可以选择不同的方式来解决这个问题。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions