H-K-Y / Genshin_Impact_bot

原神bot,这是一个基于nonebot和HoshinoBot的原神娱乐及信息查询插件,包含原神抽卡,丘丘语翻译,找资源点等功能
GNU General Public License v3.0
389 stars 85 forks source link

抽卡插件获取图标速度过慢导致插件未被加载 #58

Closed KazuhaKun closed 2 years ago

KazuhaKun commented 2 years ago

模块所采用的更新卡池图标的网站genshin.honeyhunterworld.com在部分地区访问过慢,导致抽卡模块无法被载入。

H-K-Y commented 2 years ago

发一下报错日志,是因为访问速度太慢超时了还是什么原因?

Edvision commented 2 years ago

遇到相似问题~ 2021-10-30 01:21:57.160 | INFO | hoshino.modules.genshin.gacha.pool_data:init_pool_list:235 - 正在更新卡池数据 2021-10-30 01:21:57.330 | INFO | hoshino.modules.genshin.gacha.pool_data:up_role_icon:198 - 正在更新 九条裟罗 角色图标 2021-10-30 01:22:13.906 | INFO | hoshino.modules.genshin.gacha.pool_data:up_role_icon:198 - 正在更新 早柚 角色图标 2021-10-30 01:22:21.412 | INFO | hoshino.modules.genshin.gacha.pool_data:up_role_icon:198 - 正在更新 烟绯 角色图标 [2021-10-30 01:22:31,384 nonebot] ERROR: Failed to import "hoshino.modules.genshin.gacha", error: [2021-10-30 01:22:31,385 nonebot] ERROR: Traceback (most recent call last): File "/usr/local/python3/lib/python3.8/site-packages/httpx/_transports/default.py", line 62, in map_httpcore_exceptions yield File "/usr/local/python3/lib/python3.8/site-packages/httpx/_transports/default.py", line 201, in aiter async for part in self._httpcore_stream: File "/usr/local/python3/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 57, in aiter async for chunk in self.stream: File "/usr/local/python3/lib/python3.8/site-packages/httpcore/_bytestreams.py", line 91, in aiter async for chunk in self._aiterator: File "/usr/local/python3/lib/python3.8/site-packages/httpcore/_async/http11.py", line 208, in _receive_response_data event = await self._receive_event(timeout) File "/usr/local/python3/lib/python3.8/site-packages/httpcore/_async/http11.py", line 225, in _receive_event data = await self.socket.read(self.READ_NUM_BYTES, timeout) File "/usr/local/python3/lib/python3.8/site-packages/httpcore/_backends/anyio.py", line 63, in read raise ReadTimeout from None httpcore.ReadTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/python3/lib/python3.8/site-packages/nonebot/plugin.py", line 249, in load_plugin module = importlib.import_module(module_path) File "/usr/local/python3/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 783, in exec_module File "", line 219, in _call_with_frames_removed File "/root/HoshinoBot/hoshino/modules/genshin/gacha/init.py", line 2, in from .gacha import gacha_info , FILE_PATH , Gacha , POOL File "/root/HoshinoBot/hoshino/modules/genshin/gacha/gacha.py", line 3, in from .pool_data import POOL ,UP_PROBABILITY,POOL_PROBABILITY,DISTANCE_FREQUENCY File "/root/HoshinoBot/hoshino/modules/genshin/gacha/pool_data.py", line 272, in loop.run_until_complete(init_pool_list()) File "/usr/local/python3/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete return future.result() File "/root/HoshinoBot/hoshino/modules/genshin/gacha/pool_data.py", line 263, in init_pool_list await up_role_icon(name = item_name,star = item_star) File "/root/HoshinoBot/hoshino/modules/genshin/gacha/pool_data.py", line 202, in up_role_icon role_icon = await paste_role_icon(name,star) File "/root/HoshinoBot/hoshino/modules/genshin/gacha/pool_data.py", line 147, in paste_role_icon avatar_icon = await get_icon(url) File "/root/HoshinoBot/hoshino/modules/genshin/gacha/pool_data.py", line 119, in get_icon icon = await get_url_data(url) File "/root/HoshinoBot/hoshino/modules/genshin/gacha/pool_data.py", line 69, in get_url_data resp = await client.get(url=url) File "/usr/local/python3/lib/python3.8/site-packages/httpx/_client.py", line 1704, in get return await self.request( File "/usr/local/python3/lib/python3.8/site-packages/httpx/_client.py", line 1483, in request response = await self.send( File "/usr/local/python3/lib/python3.8/site-packages/httpx/_client.py", line 1585, in send raise exc File "/usr/local/python3/lib/python3.8/site-packages/httpx/_client.py", line 1579, in send await response.aread() File "/usr/local/python3/lib/python3.8/site-packages/httpx/_models.py", line 1660, in aread self._content = b"".join([part async for part in self.aiter_bytes()]) File "/usr/local/python3/lib/python3.8/site-packages/httpx/_models.py", line 1660, in self._content = b"".join([part async for part in self.aiter_bytes()]) File "/usr/local/python3/lib/python3.8/site-packages/httpx/_models.py", line 1676, in aiter_bytes async for raw_bytes in self.aiter_raw(): File "/usr/local/python3/lib/python3.8/site-packages/httpx/_models.py", line 1730, in aiter_raw async for raw_stream_bytes in self.stream: File "/usr/local/python3/lib/python3.8/site-packages/httpx/_client.py", line 147, in aiter async for chunk in self._stream: File "/usr/local/python3/lib/python3.8/site-packages/httpx/_transports/default.py", line 202, in aiter yield part File "/usr/local/python3/lib/python3.8/contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "/usr/local/python3/lib/python3.8/site-packages/httpx/_transports/default.py", line 79, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ReadTimeout

H-K-Y commented 2 years ago

尝试修了一下,你可以试试

KazuhaKun commented 2 years ago

好的

Edvision commented 2 years ago

感谢~ 其实不是第一次用的话,更新个别图标应该问题不大。我这边因为迁移了服务器重新拉了代码。后面我自己调timeout到60就下载完了。