Skip to content

Commit

Permalink
Lazy check connection
Browse files Browse the repository at this point in the history
  • Loading branch information
agners committed Oct 9, 2024
1 parent 9f3767b commit 0325715
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion supervisor/jobs/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,14 @@ async def check_conditions(
)

if JobCondition.INTERNET_SYSTEM in used_conditions:
await coresys.sys_supervisor.check_connectivity()
# 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()
else:
coresys.sys_create_task(coresys.sys_supervisor.check_connectivity())

if not coresys.sys_supervisor.connectivity:
raise JobConditionException(
f"'{method_name}' blocked from execution, no supervisor internet connection"
Expand Down

0 comments on commit 0325715

Please sign in to comment.