mirror of
https://github.com/home-assistant/core.git
synced 2025-12-20 02:48:57 +00:00
Sonos fix media player join to avoid race condition (#159106)
This commit is contained in:
@@ -1015,11 +1015,21 @@ class SonosSpeaker:
|
||||
speakers: list[SonosSpeaker],
|
||||
) -> None:
|
||||
"""Form a group with other players."""
|
||||
# When joining multiple speakers, build the group incrementally and
|
||||
# wait for the grouping to complete after each join. This avoids race
|
||||
# conditions in zone topology updates.
|
||||
async with config_entry.runtime_data.topology_condition:
|
||||
join_list: list[SonosSpeaker] = []
|
||||
for speaker in speakers:
|
||||
_LOGGER.debug("Join %s to %s", speaker.zone_name, master.zone_name)
|
||||
join_list.append(speaker)
|
||||
group: list[SonosSpeaker] = await hass.async_add_executor_job(
|
||||
master.join, speakers
|
||||
master.join, join_list
|
||||
)
|
||||
await SonosSpeaker.wait_for_groups(hass, config_entry, [group])
|
||||
_LOGGER.debug(
|
||||
"Join Complete %s to %s", speaker.zone_name, master.zone_name
|
||||
)
|
||||
|
||||
@soco_error()
|
||||
def unjoin(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user