Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip NextBus update if integration is still loading #123564

Merged
merged 4 commits into from
Aug 18, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions homeassistant/components/nextbus/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ def has_routes(self) -> bool:
"""Check if this coordinator is tracking any routes."""
return len(self._route_stops) > 0

async def _async_update_data(self) -> dict[str, Any]:
async def _async_update_data(self) -> dict:
joostlek marked this conversation as resolved.
Show resolved Hide resolved
"""Fetch data from NextBus."""
self.logger.debug("Updating data from API. Routes: %s", str(self._route_stops))

_route_stops = set(self._route_stops)
self.logger.debug("Updating data from API. Routes: %s", str(_route_stops))

def _update_data() -> dict:
"""Fetch data from NextBus."""
self.logger.debug("Updating data from API (executor)")
predictions: dict[RouteStop, dict[str, Any]] = {}
for route_stop in self._route_stops:
for route_stop in _route_stops:
prediction_results: list[dict[str, Any]] = []
try:
prediction_results = self.client.predictions_for_stop(
Expand Down