Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions mopidy_youtube/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ def wrapper(self):
return property(wrapper)


def _future_is_set(future: pykka.Future) -> bool:
try:
future.get(timeout=0)
return True
except pykka.Timeout:
return False
except Exception:
return True


class Entry:
"""
Entry is a base class of Video and Playlist.
Expand Down Expand Up @@ -154,11 +164,8 @@ def _set_api_data(self, fields, item):
if not future:
future = self.__dict__[_k] = pykka.ThreadingFuture()

# # What was this for? Whatever it was for, it doesn't work
# # for pykka v4.3 onwards, since ThreadingFuture uses
# # a condition variable instead of a queue
# if not future._queue.empty(): # hack, no public is_set()
# continue
if _future_is_set(future):
continue

if not item:
val = None
Expand Down