Use another event loop for the synchronous websocket communication method

This commit is contained in:
Fabio Manganiello 2019-02-12 20:49:10 +01:00
parent 73d7e9a3ef
commit b555777cc8

View file

@ -109,8 +109,10 @@ class MusicMopidyBackend(Backend):
response = response.decode() response = response.decode()
resp_queue.put(json.loads(response)) resp_queue.put(json.loads(response))
loop = asyncio.get_event_loop() loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(get_response()) loop.run_until_complete(get_response())
loop.stop()
return resp_queue.get().get('result') return resp_queue.get().get('result')
def _get_tracklist_status(self): def _get_tracklist_status(self):