shaonianzhentan / cloud_music_mpd

云音乐MPD播放器
MIT License
5 stars 5 forks source link

Fix RecursionError #3

Closed catsimple closed 7 months ago

catsimple commented 7 months ago

Fix RecursionError: maximum recursion depth exceeded 修复当添加的播放列表内容数>某个值时,HA报错 RecursionError: maximum recursion depth exceeded

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:240
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 11:07:41 (2 occurrences)
Last logged: 11:09:13

[140332255857600] maximum recursion depth exceeded
[140332289624640] maximum recursion depth exceeded
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/cloud_music_mpd/media_player.py", line 389, in async_play_media
    await self.playlist_add(0)
  File "/config/custom_components/cloud_music_mpd/media_player.py", line 397, in playlist_add
    await self.playlist_add(index + 1)
  File "/config/custom_components/cloud_music_mpd/media_player.py", line 397, in playlist_add
    await self.playlist_add(index + 1)
  File "/config/custom_components/cloud_music_mpd/media_player.py", line 397, in playlist_add
    await self.playlist_add(index + 1)
  [Previous line repeated 980 more times]
  File "/config/custom_components/cloud_music_mpd/media_player.py", line 396, in playlist_add
    await self._client.add(music_info.url)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/mpd/asyncio.py", line 547, in f
    self.__command_queue.put_nowait(result)
  File "/usr/local/lib/python3.12/asyncio/queues.py", line 147, in put_nowait
    self._wakeup_next(self._getters)
  File "/usr/local/lib/python3.12/asyncio/queues.py", line 63, in _wakeup_next
    waiter.set_result(None)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 796, in call_soon
    handle = self._call_soon(callback, args, context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 812, in _call_soon
    handle = events.Handle(callback, args, self, context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/events.py", line 41, in __init__
    if self._loop.get_debug():
       ^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded