Skip to content

fix(us): fail-fast timeout on findMyCar location request - #1220

Draft
blka wants to merge 1 commit into
Hyundai-Kia-Connect:masterfrom
blka:fix/us-findmycar-timeout
Draft

fix(us): fail-fast timeout on findMyCar location request#1220
blka wants to merge 1 commit into
Hyundai-Kia-Connect:masterfrom
blka:fix/us-findmycar-timeout

Conversation

@blka

@blka blka commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Problem

HyundaiBlueLinkApiUSA._get_vehicle_location called self.session.get(url, headers=headers) with the session default timeout (connect=10, read=30). If the rcs/rfc/findMyCar endpoint hangs, the coordinator update blocks for up to 30s on read timeout.

The method already has try/except Exception returning None on failure, and the coordinator already falls back to cached vehicleLocation when location is None. So this is purely a fail-faster concern, not a correctness fix.

Fix

Pass a per-call timeout on the findMyCar request only:

response = self.session.get(url, headers=headers, timeout=(5, 10))
  • connect=5 (vs session 10), read=10 (vs session 30).
  • Only this one call. Other session.get calls in the file keep the session default.
  • On timeout, requests.exceptions.Timeout is caught by the existing except Exception → returns None → coordinator uses cached vehicleLocation.
  • No retry added — retrying would wake the vehicle and risk 12V battery drain. Fail-faster only.

Tests

New tests/us_findmycar_timeout_test.py (2 tests): asserts session.get is called with timeout=(5, 10); asserts a Timeout exception results in None (graceful). Full suite green. Ruff + pre-commit green.

@cdnninja

cdnninja commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Do we have evidence of this happening?

@blka
blka marked this pull request as draft July 7, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants