mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-26 18:46:29 +00:00
Lazy check connection
This commit is contained in:
parent
9f3767b23d
commit
032571550a
@ -383,7 +383,14 @@ class Job(CoreSysAttributes):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if JobCondition.INTERNET_SYSTEM in used_conditions:
|
if JobCondition.INTERNET_SYSTEM in used_conditions:
|
||||||
|
# Connectivity check may take up to 10s (timeout) to complete, and
|
||||||
|
# hence slow down all exection. If we know connectivity is bad,
|
||||||
|
# schedule another connectivity check but fail immeaditly.
|
||||||
|
if coresys.sys_supervisor.connectivity:
|
||||||
await coresys.sys_supervisor.check_connectivity()
|
await coresys.sys_supervisor.check_connectivity()
|
||||||
|
else:
|
||||||
|
coresys.sys_create_task(coresys.sys_supervisor.check_connectivity())
|
||||||
|
|
||||||
if not coresys.sys_supervisor.connectivity:
|
if not coresys.sys_supervisor.connectivity:
|
||||||
raise JobConditionException(
|
raise JobConditionException(
|
||||||
f"'{method_name}' blocked from execution, no supervisor internet connection"
|
f"'{method_name}' blocked from execution, no supervisor internet connection"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user