Remove timeout for backup services (#56763)

This commit is contained in:
Joakim Sørensen 2021-09-29 09:46:05 +02:00 committed by GitHub
parent 115bb39c10
commit 6a9b484f2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View File

@ -137,7 +137,7 @@ class APIEndpointSettings(NamedTuple):
command: str
schema: vol.Schema
timeout: int = 60
timeout: int | None = 60
pass_data: bool = False
@ -154,37 +154,37 @@ MAP_SERVICE_API = {
SERVICE_BACKUP_FULL: APIEndpointSettings(
"/backups/new/full",
SCHEMA_BACKUP_FULL,
300,
None,
True,
),
SERVICE_BACKUP_PARTIAL: APIEndpointSettings(
"/backups/new/partial",
SCHEMA_BACKUP_PARTIAL,
300,
None,
True,
),
SERVICE_RESTORE_FULL: APIEndpointSettings(
"/backups/{slug}/restore/full",
SCHEMA_RESTORE_FULL,
300,
None,
True,
),
SERVICE_RESTORE_PARTIAL: APIEndpointSettings(
"/backups/{slug}/restore/partial",
SCHEMA_RESTORE_PARTIAL,
300,
None,
True,
),
SERVICE_SNAPSHOT_FULL: APIEndpointSettings(
"/backups/new/full",
SCHEMA_BACKUP_FULL,
300,
None,
True,
),
SERVICE_SNAPSHOT_PARTIAL: APIEndpointSettings(
"/backups/new/partial",
SCHEMA_BACKUP_PARTIAL,
300,
None,
True,
),
}
@ -418,7 +418,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
hass.data[DOMAIN] = hassio = HassIO(hass.loop, websession, host)
if not await hassio.is_connected():
_LOGGER.warning("Not connected with Hass.io / system too busy!")
_LOGGER.warning("Not connected with the supervisor / system too busy!")
store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
data = await store.async_load()
@ -520,8 +520,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
payload=payload,
timeout=api_endpoint.timeout,
)
except HassioAPIError as err:
_LOGGER.error("Error on Supervisor API: %s", err)
except HassioAPIError:
# The exceptions are logged properly in hassio.send_command
pass
for service, settings in MAP_SERVICE_API.items():
hass.services.async_register(

View File

@ -287,7 +287,7 @@ async def test_warn_when_cannot_connect(hass, caplog):
assert result
assert hass.components.hassio.is_hassio()
assert "Not connected with Hass.io / system too busy!" in caplog.text
assert "Not connected with the supervisor / system too busy!" in caplog.text
async def test_service_register(hassio_env, hass):