From: Marcel van der Veldt Date: Sun, 26 May 2019 20:21:57 +0000 (+0200) Subject: avoiding deadlock situation X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=cf39778bc16d96d16243dee8ef34be7f1f763d46;p=music-assistant-server.git avoiding deadlock situation --- diff --git a/music_assistant/modules/player.py b/music_assistant/modules/player.py index 02f3d8a2..330eebe6 100755 --- a/music_assistant/modules/player.py +++ b/music_assistant/modules/player.py @@ -123,11 +123,7 @@ class Player(): group_player = self._players[player.group_parent] if group_player.settings['apply_group_power']: player_childs = [item for item in self._players.values() if item.group_parent == group_player.player_id] - if not group_player.powered and cmd == 'power' and cmd_args == 'on': - # power on group player - self.mass.event_loop.create_task( - self.player_command(group_player.player_id, 'power', 'on')) - elif group_player.powered and cmd == 'power' and cmd_args == 'off': + if group_player.powered and cmd == 'power' and cmd_args == 'off': # check if the group player should still be turned on new_powered = False for child_player in player_childs: @@ -135,8 +131,7 @@ class Player(): new_powered = True break if not new_powered: - self.mass.event_loop.create_task( - self.player_command(group_player.player_id, 'power', 'off')) + await self.player_command(group_player.player_id, 'power', 'off') async def remove_player(self, player_id): ''' handle a player remove ''' diff --git a/music_assistant/modules/playerproviders/chromecast.py b/music_assistant/modules/playerproviders/chromecast.py index 96a4110a..5259f53d 100644 --- a/music_assistant/modules/playerproviders/chromecast.py +++ b/music_assistant/modules/playerproviders/chromecast.py @@ -62,7 +62,7 @@ class ChromecastProvider(PlayerProvider): ''' issue command on player (play, pause, next, previous, stop, power, volume, mute) ''' count = 0 while self._chromecasts[player_id].is_busy and count < 10: - asyncio.sleep(0.1) + await asyncio.sleep(0.1) count += 1 self._chromecasts[player_id].is_busy = True if cmd == 'play': @@ -108,7 +108,7 @@ class ChromecastProvider(PlayerProvider): ''' count = 0 while self._chromecasts[player_id].is_busy and count < 10: - asyncio.sleep(0.1) + await asyncio.sleep(0.1) count += 1 self._chromecasts[player_id].is_busy = True castplayer = self._chromecasts[player_id]