mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Remove timeout for backup services (#56763)
This commit is contained in:
parent
115bb39c10
commit
6a9b484f2d
@ -137,7 +137,7 @@ class APIEndpointSettings(NamedTuple):
|
|||||||
|
|
||||||
command: str
|
command: str
|
||||||
schema: vol.Schema
|
schema: vol.Schema
|
||||||
timeout: int = 60
|
timeout: int | None = 60
|
||||||
pass_data: bool = False
|
pass_data: bool = False
|
||||||
|
|
||||||
|
|
||||||
@ -154,37 +154,37 @@ MAP_SERVICE_API = {
|
|||||||
SERVICE_BACKUP_FULL: APIEndpointSettings(
|
SERVICE_BACKUP_FULL: APIEndpointSettings(
|
||||||
"/backups/new/full",
|
"/backups/new/full",
|
||||||
SCHEMA_BACKUP_FULL,
|
SCHEMA_BACKUP_FULL,
|
||||||
300,
|
None,
|
||||||
True,
|
True,
|
||||||
),
|
),
|
||||||
SERVICE_BACKUP_PARTIAL: APIEndpointSettings(
|
SERVICE_BACKUP_PARTIAL: APIEndpointSettings(
|
||||||
"/backups/new/partial",
|
"/backups/new/partial",
|
||||||
SCHEMA_BACKUP_PARTIAL,
|
SCHEMA_BACKUP_PARTIAL,
|
||||||
300,
|
None,
|
||||||
True,
|
True,
|
||||||
),
|
),
|
||||||
SERVICE_RESTORE_FULL: APIEndpointSettings(
|
SERVICE_RESTORE_FULL: APIEndpointSettings(
|
||||||
"/backups/{slug}/restore/full",
|
"/backups/{slug}/restore/full",
|
||||||
SCHEMA_RESTORE_FULL,
|
SCHEMA_RESTORE_FULL,
|
||||||
300,
|
None,
|
||||||
True,
|
True,
|
||||||
),
|
),
|
||||||
SERVICE_RESTORE_PARTIAL: APIEndpointSettings(
|
SERVICE_RESTORE_PARTIAL: APIEndpointSettings(
|
||||||
"/backups/{slug}/restore/partial",
|
"/backups/{slug}/restore/partial",
|
||||||
SCHEMA_RESTORE_PARTIAL,
|
SCHEMA_RESTORE_PARTIAL,
|
||||||
300,
|
None,
|
||||||
True,
|
True,
|
||||||
),
|
),
|
||||||
SERVICE_SNAPSHOT_FULL: APIEndpointSettings(
|
SERVICE_SNAPSHOT_FULL: APIEndpointSettings(
|
||||||
"/backups/new/full",
|
"/backups/new/full",
|
||||||
SCHEMA_BACKUP_FULL,
|
SCHEMA_BACKUP_FULL,
|
||||||
300,
|
None,
|
||||||
True,
|
True,
|
||||||
),
|
),
|
||||||
SERVICE_SNAPSHOT_PARTIAL: APIEndpointSettings(
|
SERVICE_SNAPSHOT_PARTIAL: APIEndpointSettings(
|
||||||
"/backups/new/partial",
|
"/backups/new/partial",
|
||||||
SCHEMA_BACKUP_PARTIAL,
|
SCHEMA_BACKUP_PARTIAL,
|
||||||
300,
|
None,
|
||||||
True,
|
True,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||||||
hass.data[DOMAIN] = hassio = HassIO(hass.loop, websession, host)
|
hass.data[DOMAIN] = hassio = HassIO(hass.loop, websession, host)
|
||||||
|
|
||||||
if not await hassio.is_connected():
|
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)
|
store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
|
||||||
data = await store.async_load()
|
data = await store.async_load()
|
||||||
@ -520,8 +520,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||||||
payload=payload,
|
payload=payload,
|
||||||
timeout=api_endpoint.timeout,
|
timeout=api_endpoint.timeout,
|
||||||
)
|
)
|
||||||
except HassioAPIError as err:
|
except HassioAPIError:
|
||||||
_LOGGER.error("Error on Supervisor API: %s", err)
|
# The exceptions are logged properly in hassio.send_command
|
||||||
|
pass
|
||||||
|
|
||||||
for service, settings in MAP_SERVICE_API.items():
|
for service, settings in MAP_SERVICE_API.items():
|
||||||
hass.services.async_register(
|
hass.services.async_register(
|
||||||
|
@ -287,7 +287,7 @@ async def test_warn_when_cannot_connect(hass, caplog):
|
|||||||
assert result
|
assert result
|
||||||
|
|
||||||
assert hass.components.hassio.is_hassio()
|
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):
|
async def test_service_register(hassio_env, hass):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user