Skip to content

Commit

Permalink
Retry on more Plex connection failures during startup (#69822)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlawren authored and balloob committed Apr 11, 2022
1 parent 8e3e6ef commit 02eec73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion homeassistant/components/plex/__init__.py
Expand Up @@ -159,7 +159,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
entry.data[CONF_SERVER],
error,
)
return False
# Retry as setups behind a proxy can return transient 404 or 502 errors
raise ConfigEntryNotReady from error

_LOGGER.debug(
"Connected to: %s (%s)", plex_server.friendly_name, plex_server.url_in_use
Expand Down
2 changes: 1 addition & 1 deletion tests/components/plex/test_init.py
Expand Up @@ -63,7 +63,7 @@ async def test_setup_config_entry_with_error(hass, entry):
await hass.async_block_till_done()

assert len(hass.config_entries.async_entries(const.DOMAIN)) == 1
assert entry.state is ConfigEntryState.SETUP_ERROR
assert entry.state is ConfigEntryState.SETUP_RETRY


async def test_setup_with_insecure_config_entry(hass, entry, setup_plex_server):
Expand Down

0 comments on commit 02eec73

Please sign in to comment.