Skip to content

Commit ba1f0bc

Browse files
committed
delete retry
1 parent 6e043a9 commit ba1f0bc

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

fuo_netease/provider.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from feeluown.utils.reader import create_reader, SequentialReader
1111
from .api import API, CodeShouldBe200
1212
from .login_controller import LoginController
13+
from .excs import NeteaseIOError
1314

1415

1516
logger = logging.getLogger(__name__)
@@ -132,18 +133,12 @@ def current_user_list_radio_songs(self, count: int = 3) -> List[SongModel]:
132133
if count <= 0:
133134
return []
134135

135-
songs: List[SongModel] = []
136-
attempts = 0
137-
# We retry a few times to honor count while avoiding infinite loops.
138-
while len(songs) < count and attempts < 3:
139-
songs_data = self.api.get_radio_music()
140-
if not songs_data:
141-
logger.error('data should not be None')
142-
break
143-
songs.extend(_deserialize(song_data, V2SongSchema)
144-
for song_data in songs_data)
145-
attempts += 1
136+
songs_data = self.api.get_radio_music()
137+
if not songs_data:
138+
raise NeteaseIOError('failed to fetch radio songs')
146139

140+
songs = [_deserialize(song_data, V2SongSchema)
141+
for song_data in songs_data]
147142
return songs[:count]
148143

149144
def rec_list_daily_playlists(self):

0 commit comments

Comments
 (0)